You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the output path doesn't exist, then shiv will fail with an error FileNotFoundError: [Errno 2] No such file or directory.
Log
Traceback (most recent call last):
File "/tmp/test/.venv/bin/shiv", line 8, in <module>
sys.exit(main())
File "/tmp/test/.venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/tmp/test/.venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/tmp/test/.venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/tmp/test/.venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/tmp/test/.venv/lib/python3.10/site-packages/shiv/cli.py", line 269, in main
builder.create_archive(
File "/tmp/test/.venv/lib/python3.10/site-packages/shiv/builder.py", line 94, in create_archive
with target.open(mode="wb") as fd:
File "/usr/lib/python3.10/pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: 'dist/main'
Hi @vitoyucepi
Thanks for the report, I agree that shiv could & should create the path if it doesn't exist. I'm happy to make this change, but I would also accept a PR with the same, assuming it comes with a test :)
Summary
If the output path doesn't exist, then shiv will fail with an error
FileNotFoundError: [Errno 2] No such file or directory
.Log
To reproduce
python -m venv .venv
. .venv/bin/activate
pip install shiv==1.0.3
echo "print('hello world')" >> __main__.py
shiv -e __main__.py -o dist/main --site-packages .venv/lib/python3.10/site-packages/
Expected behavior
Shiv should create leading directories if they do not exist.
Versions
Additional
Maybe something like
should be inserted somewhere here
shiv/src/shiv/builder.py
Lines 93 to 94 in eeec71f
The text was updated successfully, but these errors were encountered: