pew-org / pew

A tool to manage multiple virtual environments written in pure python
MIT License
1.17k stars 81 forks source link

Fix list_pythons crash when Pythonz is not installed. #201

Closed djl closed 5 years ago

djl commented 5 years ago

Before:

$ pew list_pythons
Traceback (most recent call last):
  File "/usr/sbin/pew", line 11, in <module>
    load_entry_point('pew==1.1.5', 'console_scripts', 'pew')()
  File "/usr/lib/python3.7/site-packages/pew/pew.py", line 758, in pew
    return command(sys.argv[2:])
  File "/usr/lib/python3.7/site-packages/pew/pew.py", line 662, in list_pythons_cmd
    Path(PATH_PYTHONS).mkdir(parents=True)
NameError: name 'PATH_PYTHONS' is not defined

After:

$ pew list_pythons
You need to install the pythonz extra.  pip install pew[pythonz]
berdario commented 5 years ago

Thanks a lot!

I changed the implementation, since I think it's better to keep the custom logic close to the Pythonz code (so that we don't needlessly touch the filesystem on systems that won't use pythonz), rather than catch a NameError (all NameErrors should be programming/syntax/build errors, not runtime)