From 816cafde700e361394fd206b832cd3637254c623 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 22 Mar 2024 15:35:22 +0800 Subject: [PATCH] legend should not accept a list of spec files --- pygmt/src/legend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pygmt/src/legend.py b/pygmt/src/legend.py index fcf5afac82d..e5a7ebefab0 100644 --- a/pygmt/src/legend.py +++ b/pygmt/src/legend.py @@ -8,6 +8,7 @@ build_arg_list, data_kind, fmt_docstring, + is_nonstr_iter, kwargs_to_strings, use_alias, ) @@ -77,7 +78,8 @@ def legend(self, spec=None, position="JTR+jTR+o0.2c", box="+gwhite+p1p", **kwarg with Session() as lib: if spec is None: specfile = "" - elif data_kind(spec) == "file": + elif data_kind(spec) == "file" and not is_nonstr_iter(spec): + # Is a file but not a list of files specfile = spec else: raise GMTInvalidInput(f"Unrecognized data type: {type(spec)}")