mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
fix: handling for exceptional cases in sfcf_read improved
This commit is contained in:
parent
75111b07ff
commit
b0e98de083
1 changed files with 2 additions and 2 deletions
|
@ -112,12 +112,12 @@ def read_sfcf(path, prefix, name, quarks='.*', noffset=0, wf=0, wf2=0,
|
||||||
else:
|
else:
|
||||||
ls.extend(filenames)
|
ls.extend(filenames)
|
||||||
break
|
break
|
||||||
if not ls:
|
|
||||||
raise Exception('Error, directory not found')
|
|
||||||
# Exclude folders with different names
|
# Exclude folders with different names
|
||||||
for exc in ls:
|
for exc in ls:
|
||||||
if not fnmatch.fnmatch(exc, prefix + '*'):
|
if not fnmatch.fnmatch(exc, prefix + '*'):
|
||||||
ls = list(set(ls) - set([exc]))
|
ls = list(set(ls) - set([exc]))
|
||||||
|
if not ls:
|
||||||
|
raise Exception('No matching directories found.')
|
||||||
if len(ls) > 1:
|
if len(ls) > 1:
|
||||||
ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0]))
|
ls.sort(key=lambda x: int(re.findall(r'\d+', x[len(prefix):])[0]))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue