Skip to content

Commit

Permalink
better exceptions for data extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
otvam committed Dec 20, 2024
1 parent 4625fde commit 1527d68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pypeec/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ def _run_extract(data_name, path_extract):
folder = importlib.resources.files("pypeec.data")
with importlib.resources.as_file(folder.joinpath(data_name)) as fid:
shutil.unpack_archive(fid, path_extract, format="xztar")
except FileNotFoundError:
print("data extraction: extraction failure", flush=True, file=sys.stderr)
print("data extraction: data is not packaged", flush=True, file=sys.stderr)
except OSError:
print("data extraction: failure", flush=True, file=sys.stderr)
print("data extraction: extraction failure", flush=True, file=sys.stderr)
print("data extraction: extraction problem", flush=True, file=sys.stderr)

# teardown
print("data extraction: finished", flush=True, file=sys.stderr)
Expand Down

0 comments on commit 1527d68

Please sign in to comment.