vox activate
fails when currently active virtualenv is removed
#3
Labels
bug
Something isn't working
vox activate
fails when currently active virtualenv is removed
#3
xonfig
Clean install (inside a temp virtualenv), started as
xonsh --no-rc
Expected Behavior
The old virtualenv should be deactivated and the new virtualenv should be activated
Current Behavior
An error message is shown, old virtualenv is deactivated but new virtualenv isn't activated.
Steps to Reproduce
Open 2 xonsh instances.
In xonsh instance 1:
In xonsh instance 2:
or just remove or rename the virtualenv directory directly.
Back in xonsh instance 1:
Note that a second
vox activate bar
does succeed (as thefoo
virtualenv has been deactivated by the first attempt):Additional info
Some quick debugging seems to indicate the problem is due to https://github.com/xonsh/xonsh/blob/master/xontrib/voxapi.py#L288 , the
ve.bin
dir doesn't exist (obviously, the virtualenv got removed ;) ) so theelse:
part of the for loop gets triggered, raising aKeyError
. This gets caught by theexcept KeyError:
part incmd_activate()
( https://github.com/xonsh/xonsh/blob/master/xontrib/vox.py#L161 ).For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 commentThe text was updated successfully, but these errors were encountered: