Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrap_zenodo.py: bug when output directory does not exist #23

Open
benoistlaurent opened this issue Aug 16, 2023 · 0 comments
Open

scrap_zenodo.py: bug when output directory does not exist #23

benoistlaurent opened this issue Aug 16, 2023 · 0 comments

Comments

@benoistlaurent
Copy link

Command:

python scripts/scrap_zenodo.py --query params/query_dev.yml --output tmp

Result:

Traceback (most recent call last):
  File "/Users/laurent/Downloads/mdws/scripts/scrap_zenodo.py", line 363, in <module>
    log_file = logging.FileHandler(f"{ARGS.output}/scrap_zenodo.log", mode="w")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/modules/python/3.11.4/lib/python3.11/logging/__init__.py", line 1181, in __init__
    StreamHandler.__init__(self, self._open())
                                 ^^^^^^^^^^^^
  File "/opt/modules/python/3.11.4/lib/python3.11/logging/__init__.py", line 1213, in _open
    return open_func(self.baseFilename, self.mode,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/laurent/Downloads/mdws/tmp/scrap_zenodo.log'

Proposed solution:

Test if output directory exists and, if not, create it (or die with explicit error message).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant