From b0e98de0835aa07328d32fc597fb76979ae1f1e4 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Fri, 21 Jan 2022 13:39:56 +0000 Subject: [PATCH] fix: handling for exceptional cases in sfcf_read improved --- pyerrors/input/sfcf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyerrors/input/sfcf.py b/pyerrors/input/sfcf.py index a3bf2dec..8d73423d 100644 --- a/pyerrors/input/sfcf.py +++ b/pyerrors/input/sfcf.py @@ -112,12 +112,12 @@ def read_sfcf(path, prefix, name, quarks='.*', noffset=0, wf=0, wf2=0, else: ls.extend(filenames) break - if not ls: - raise Exception('Error, directory not found') # Exclude folders with different names for exc in ls: if not fnmatch.fnmatch(exc, prefix + '*'): ls = list(set(ls) - set([exc])) + if not ls: + raise Exception('No matching directories found.') if len(ls) > 1: ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0]))