I outsmarted myself and created an error as a result of trying to be prepared.
On the first line of a script I placed
#! /usr/bin/python
and later upgraded python and installed a new module. Sure enough, the new python is now /opt/local/bin/python
and I got errors. It took a bit of debugging before I found this.
Anyway, now that I have I am wondering what is the best way to run a script:
Should I:
- use
python <myscript.py>
or - make it executable, add the environment on the first line, and use it from the command line
./<myscript.py>
I like 2.
but upon upgrading or changing the default python, the script can break because it specifies a different install.
Then am I expected to go through all the scripts and update them?
Is there a way to make the current/default python override the one specified on line1 of the script or is there another way to make a script executable without explicitly stating which python it uses (ie, to use the default one)?