jnoortheen / xontrib-avox-poetry

auto-activate venv as one cd into a poetry project
MIT License
3 stars 2 forks source link

Unhandled FileNotFound error when loading in directory without venv #4

Closed rpdelaney closed 2 years ago

rpdelaney commented 2 years ago
$ xonsh
Traceback (Most recent call last):
71 /Users/ryan/.local/pipx/venvs/xonsh/lib/python3.10/site-packages/xontrib/avox_poetry/venv.py on_post_init --> activate_venv(P
ath.cwd())
46 /Users/ryan/.local/pipx/venvs/xonsh/lib/python3.10/site-packages/xontrib/avox_poetry/venv.py activate_venv --> venv = get_ven
v_path(path)
28 /Users/ryan/.local/pipx/venvs/xonsh/lib/python3.10/site-packages/xontrib/avox_poetry/venv.py get_venv_path --> venv = has_ven
v_with_same_name(path.name)
19 /Users/ryan/.local/pipx/venvs/xonsh/lib/python3.10/site-packages/xontrib/avox_poetry/venv.py has_venv_with_same_name --> for
env in iter_venvs():
40 /Users/ryan/.local/pipx/venvs/xonsh/lib/python3.10/site-packages/xontrib/avox_poetry/venv_poetry.py iter_venvs --> yield from
 (
1015 /Users/ryan/.asdf/installs/python/3.10.0/lib/python3.10/pathlib.py iterdir --> for name in self._accessor.listdir(self):
FileNotFoundError: [Errno 2] No such file or directory: '/Users/ryan/.virtualenvs'
Exception raised in event handler; ignored.
$ xontrib list
abbrevs             installed      loaded
argcomplete         installed      loaded
autovox             installed      loaded
avox_poetry         installed      loaded
bashisms            installed      not-loaded
coreutils           installed      not-loaded
direnv              installed      loaded
distributed         installed      not-loaded
free_cwd            installed      not-loaded
history_encrypt     installed      not-loaded
homebrew            installed      loaded
jedi                installed      not-loaded
kitty               installed      loaded
mpl                 installed      not-loaded
mplhooks            installed      not-loaded
pdb                 installed      not-loaded
prompt_ret_code     installed      not-loaded
readable-traceback  installed      loaded
thefuck             installed      loaded
vox                 installed      not-loaded
voxapi              installed      loaded
whole_word_jumping  installed      loaded
xog                 installed      not-loaded
rpdelaney commented 2 years ago

I create my virtualenvs in-project, using the virtualenvs.in-project option in my poetry config. Does this xontrib support that workflow?

jnoortheen commented 2 years ago

The fix was in master. I just released a new version to PYPI.

virtualenvs.in-project

This is supported. It will activate .venv if found in the current directory

rpdelaney commented 2 years ago

Working now. Thanks so much for this! I can finally convert to xonsh fully I think :D