[Tutor] shebang question

Michael P. Reilly arcege at gmail.com
Sun Nov 26 19:33:04 CET 2006

Very true about Python being installed in different places.  In fact, for
system compatibility reasons, it is sometime required that two or three very
different releases of Python need to exist on the same system.  If more than
one happen to be in your path, then the use of "env python" becomes a
craps-shoot.  Env is not to be used in shebang unless you specifically using
it for the purpose it was designed for, and then make sure it is used
properly - "#!/usr/bin/env python" is not proper use.

FYI, most all good UNIX products for the last number of decades ship scripts
with fully qualified pathnames in the shebang lines.  As part of the
installation, if required, the line will be rewriten to the proper value.


On 11/26/06, زياد بن عبدالعزيز الباتلي <zamb at saudi.net.sa> wrote:
> "john maclean" <jayeola at gmail.com> On Sun, 26 Nov 2006 01:34:28 +0000
> wrote:
> > From what I can tell/remember, the first works in the *nix environment
> > if python is in your $PATH, ...
> Actually, no.  The first will try to feed the script to the executable
> "/usr/bin/python".  If that doesn't exist (or is not executable) it'll
> fail.
> > ...the latter will find python "somehere" on your system by looking at
> > wher the executables should be.
> True, assuming there's "/usr/bin/env" on your system (and is executable)
> and that "python" is found in your "$PATH" (and is executable).
> The problem is that Python is not installed in the same place on all
> OSes!  Some will install it under "/usr/local", others under "/opt".
> The idea of "/usr/bin/env" is that it's always installed there (or it
> should be!).  So, you don't need to figure out where is python (or perl,
> ruby, make, sed, awk, or any other executable that "feeds" on
> scripts/text files) installed as long as it's in your "$PATH".
> (Of course, "env" have other uses.  As long as I can tell, this is not
> the intended use of "env".  See "info env" for more information, or
> if you don't have "info" see the manual.)
> Ziyad.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

There's so many different worlds,
So many different suns.
And we have just one world,
But we live in different ones.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061126/d140ac6e/attachment.html 

More information about the Tutor mailing list