duelling pythons

Mats Wichmann mats at laplaza.org
Wed Apr 3 14:43:28 EST 2002


On 3 Apr 2002 08:08:18 GMT, Tobias Klausmann
<klausman-un030402 at tuts.net> wrote:

:Cliff Wells <logiplexsoftware at earthlink.net> wrote:
:> On 01 Apr 2002 21:56:44 -0500
:> nbecker at fred.net wrote:
:> 
:>> Keep lobbying Redhat.  The correct solution is for them to put
:>> 
:>> #! /usr/bin/python1.5
:>> 
:>> If they need a specific version.  I argued this with them already.
:>> Keep up the pressure.  Maybe they will get it.
:> 
:> Absolutely agree.  Or better #!/usr/bin/python.rh with a link python.rh ->
:> python1.5 so they can eventually upgrade without changing every shebang.
:
:In a related matter: how common is /usr/bin/env ?
:I really like that tool to run python wherever it is: 
:
:#!/usr/bin/env python
:
:As it is part of sh-utils, I guess it's pretty widely used.
:
:Anybody know of specific environments where it is not commonly
:available?

Windows :-)

It's a standard utility from the UNIX world so it's pretty widespread.

The thing to remember with env is that it uses the current environment
to lookup the thing named python.  Which is great if you can precisely
control this in all cases that matter.  The environment /is/ going to
be different between your interactive shell and some other program
started in a different context, such as "cron" (which could be asked
to run a Python script for you), or a webserver (as in using Python
for cgi scripts).   That's fine as long as you remember to check what
"env" will find in non-shell contexts, and make any necessary
adjustments.
Mats Wichmann




More information about the Python-list mailing list