sashahart / vex

Run a command in the named virtualenv.
MIT License
372 stars 26 forks source link

AssertionError when ~/.virtualenvs does not exist #10

Closed jdevera closed 10 years ago

jdevera commented 10 years ago

I'm trying vez for the first time, I try to run:

vez --shell-config bash

And I get this:

Traceback (most recent call last):
  File "/home/jdevera/.local/bin/vex", line 11, in <module>
    sys.exit(main())
  File "/home/jdevera/.local/lib/python2.7/site-packages/vex/main.py", line 161, in main
    returncode = _main(os.environ, argv)
  File "/home/jdevera/.local/lib/python2.7/site-packages/vex/main.py", line 118, in _main
    return handle_shell_config(options.shell_to_configure, vexrc, environ)
  File "/home/jdevera/.local/lib/python2.7/site-packages/vex/shell_config.py", line 57, in handle_shell_config
    data = shell_config.shell_config_for(shell, vexrc, environ)
  File "/home/jdevera/.local/lib/python2.7/site-packages/vex/shell_config.py", line 48, in shell_config_for
    assert os.path.exists(ve_base)
AssertionError

I only found out that the problem was my missing ~.virtualenvs until I poked in the code. But I'd suggest having a human readable error for this case.

sashahart commented 10 years ago

Thanks for reporting the error and particularly for including a traceback. So this happens if people try to use vex --shell-config without making a virtualenv, setting up manually or having used another tool like virtualenvwrapper before. I'll leave the assert as it is, because it's a safeguard which clearly told me the story, and the condition you encountered shouldn't happen now anyway.

It's not going to be a killer bug or occur for most people, so I am going to wait on doing a new version release until I have cleared out any other immediate pending issues. It shouldn't be more than a few days at maximum. But I pushed the solution to this to github, so this is fixed as of 93d39dabe32c2e9ab5c717311ddcb078471bce53.

sashahart commented 10 years ago

The other issue is a WIndows thing that likely depends on an upstream bug in virtualenv, so I pushed a new version 0.0.11 for this. Have fun.