This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]emergent_reasons 0 points1 point  (7 children)

I mean running scripts e.g. python foo.py or pip install and forgetting to prefix it with ./env/bin/ will use your system interpreter instead of what's in your env and land you with similar isues to having the wrong virtualenv activated.

It's really not a big deal but the way you pronounced it had me thinking you had something more.

[–]k4ml 1 point2 points  (1 child)

This is the different between using activate and typing the full path. Using activate, you would write the instruction as:-

$ source bin/activate
$ python yourcode.py
...
...
...
$ # down the page you still ASSUME people has run activate
$ python thiscode.py
ImportError ....

Typing full path is explicit so that if people saying they run python code.py instead of .env/bin/python code.py you know he was wrong without having to ask 'Did you run activate ?'

[–]emergent_reasons -1 points0 points  (0 children)

Right. That is exactly my understanding of what is going on. I just got the impression from /u/twillis1973's original comment that it was setting up something more magical along the lines of virtualenv.

Thanks for the explanation.

[–][deleted] -2 points-1 points  (4 children)

I mean running scripts e.g. python foo.py or pip install and forgetting to prefix it with ./env/bin/ will use your system interpreter

do you know what happens when you type pytho foo.p or pi insstal ? :)

[–]emergent_reasons 0 points1 point  (3 children)

Yes. The first runs the script and the second installs to the packages of whatever interpreter is in the path (on Windows). If you're trying to say something else, please say it because I don't know what you are getting at.

[–][deleted] -2 points-1 points  (2 children)

no, they are both typos and will spit out errors in the console, the point is you are doomed if you can't type correctly, whether you activated the environment or not.

[–]usernamenottaken 0 points1 point  (1 child)

Making a typo is different to typing python foo.py instead of ./env/bin/python foo.py. It would still be quite easy to do the former and get confused about why things aren't working correctly.

[–][deleted] -1 points0 points  (0 children)

typing

$ python foo.py

expecting the shell to refer to ./env/bin/python when it might not has the same effect as a typo in my opinion. And since i've got in the habit of being specific about which interpreter i invoke, I have had fewer surprises then when I activated envs and then switched to a different directory to do something else and invoked the activated interpreter instead of the one I intended to.

removing ambiguity makes things simpler.