[lug] q:#!/usr/bin/env python

Chan Kar Heng chankarheng at gmail.com
Sun Dec 11 12:44:27 MST 2011


Hi,

Would like to seek some opinion & advise on how #!/usr/bin/env python is 
different from #!/usr/bin/python.
I do know that env python would make env search for python in PATH & run 
that instance, but am looking for a difference beyond that due to a 
problem I'm having. Would like to understand so that I can debug more on 
my own.

Say I have "#!/usr/bin/env python" at the start of a script called 
/opt/alarmed/alarmed.py.

Running command below successfully executes the script & brings up the 
GUI perfectly well:

python /opt/alarmed/alarmed.py

However, running command below, successfully executes the script too, 
but the GUI becomes broken.

env python /opt/alarmed/alarmed.py

So, I'd like to understand what's different between the 2 (using 
/usr/bin/env & not using it)...

There're even posts on this:

http://talk.maemo.org/archive/index.php/t-42159.html

It's not conclusive yet however..

Thanks in advance & best regards,

KarHeng



More information about the LUG mailing list