Skip to content

Commit

Permalink
Print the wrong filename when not found (#427)
Browse files Browse the repository at this point in the history
* Print the wrong filename when not found

* Fix it
  • Loading branch information
dnerini authored Aug 21, 2024
1 parent e3eed9e commit b4b41a5
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions pysteps/io/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _find_matching_filename(
date, root_path, path_fmt, fn_pattern, fn_ext, silent=False
):
path = _generate_path(date, root_path, path_fmt)
fn = None

if os.path.exists(path):
fn = datetime.strftime(date, fn_pattern) + "." + fn_ext
Expand All @@ -111,15 +110,15 @@ def _find_matching_filename(
fn = os.path.join(path, fn)

if os.path.exists(fn):
fn = fn
return fn
else:
fn = None
if not silent:
print("file not found: %s" % fn)
elif not silent:
print("path", path, "not found.")

return fn
print(f"file not found: {fn}")
return None
else:
if not silent:
print(f"path not found: {path}")
return None


def _generate_path(date, root_path, path_format):
Expand Down

0 comments on commit b4b41a5

Please sign in to comment.