newbie q: /usr/bin/env why?
Erik Max Francis
max at alcyone.com
Sat Aug 26 19:32:15 EDT 2000
Matthew Dixon Cowles wrote:
> Putting /usr/bin/env in the #! line will
> start the Python interpreter as long as the interpreter is somewhere
> in the user's PATH. For interactive use, that's a reasonable
> assumption. But in some cases, such as CGI scripts and scripts run
> from cron, the "user" generally has a very minimal environment set up
> and the Python interpreter may not be in a directory that's listed in
> the PATH environment variable. In those circumstances, it's better in
> my opinion to hard-code the interpreter's location than to fiddle the
> PATH variable.
Indeed. The other case in which you'd probably be better off hardcoding
the path to the interpreter is when you want to avoid as much overhead
as possible; excuting env and then executing python will take longer
than just executing python. But that is a pretty negligible overhead
compared to that of starting up the interpreter itself. Still, since
we're nitpicking ...
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Many would be cowards if they had courage enough.
\__/ Thomas Fuller
Alcyone Systems' CatCam / http://www.catcam.com/
What do your pets do all day while you're at work? Find out.
More information about the Python-list
mailing list