Skip to content

Commit

Permalink
more meaningful error for prefix mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
cbyrohl committed Oct 15, 2024
1 parent 31fca3f commit e192474
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scida/io/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,13 @@ def _get_chunkedfiles(
files = np.array(files)
prfxs = sorted([f.split(".")[0] for f in files])
if fileprefix is None:
if len(prfxs) == 0:
# warn if no files found
msg = "No files found in directory '%s' for prefix '%s'" % (
path,
fileprefix,
)
raise ValueError(msg)
prfx = prfxs[0]
prfxs = [prfx]
files = np.array([f for f in files if f.startswith(prfx)])
Expand Down

0 comments on commit e192474

Please sign in to comment.