jaraco / pip-run

pip-run - dynamic dependency loader for Python
MIT License
130 stars 19 forks source link

`FileNotFoundError: [Errno 2] No such file or directory` on cache dir when using PIP_RUN_MODE=persist #68

Closed vergenzt closed 1 year ago

vergenzt commented 1 year ago
$ PIP_RUN_MODE=ephemeral pip-run cogapp jinja2 -- -c 'print("Hello, world!")'
Hello, world!
$ PIP_RUN_MODE=persist pip-run cogapp jinja2
Traceback (most recent call last):
  File "/Users/tim.vergenz/.local/bin/pip-run", line 8, in <module>
    sys.exit(run())
  File "/Users/tim.vergenz/.local/pipx/venvs/pip-run/lib/python3.10/site-packages/pip_run/__init__.py", line 16, in run
    with deps.load(*deps.not_installed(pip_args)) as home:
  File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "/Users/tim.vergenz/.local/pipx/venvs/pip-run/lib/python3.10/site-packages/pip_run/deps.py", line 71, in load
    if Install.parse(args) and empty(target):
  File "/Users/tim.vergenz/.local/pipx/venvs/pip-run/lib/python3.10/site-packages/pip_run/deps.py", line 63, in empty
    return not bool(list(path.iterdir()))
  File "/usr/local/Cellar/python@3.10/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1017, in iterdir
    for name in self._accessor.listdir(self):
FileNotFoundError: [Errno 2] No such file or directory: '/Users/tim.vergenz/Library/Caches/pip run/46c2e940e575bf9c8d624e577b31fde628afd8b35f2d1f1634b83d1bc5dfb190'

Installed via:

$ pipx reinstall pip-run
uninstalled pip-run! ✨ 🌟 ✨
  installed package pip-run 10.0.3, installed using Python 3.10.9
  These apps are now globally available
    - pip-run
done! ✨ 🌟 ✨
jaraco commented 1 year ago

I suspect the switch to platformdirs is implicated (https://github.com/jaraco/pip-run/commit/4ebfe1b1bf632cf99b7d0d9467630ac8c6ba6aa7), as app_paths would ensure a directory exists.