how to run python script from Unix Shell?

Mats Wichmann mats at laplaza.org
Mon Sep 17 07:35:59 EDT 2001


On 7 Sep 2001 19:47:41 GMT, Marcin 'Qrczak' Kowalczyk
<qrczak at knm.org.pl> wrote:

:Fri, 07 Sep 2001 15:43:03 -0000, Donn Cave <donn at drizzle.com> pisze:
:
:> python will in any case be somewhere in PATH, just not so
:> reliably in /usr/bin.
:
:Some filesystem hierarchy standards (sorry, I forgot which),
:probably specific to Linux, but maybe more general - declare that all
:interpreters which are meant to be used through #! should be placed in
:/usr/bin or have symlinks there, except some programs placed in /bin
:(shells I think).
:
:In particular the default python interpreter should be in /usr/bin,
:not just in /usr/local/bin or whatever.
:
:I prefer this convention. Using env doesn't allow to pass an extra
:parameter to the interpreter, it's not clear to which interpreters
:it should be applied, it fools package dependency finders, and it's
:just ugly.
:
:Let's make #!/usr/bin/python work instead of requiring workarounds
:from all scripts.

I should probably point out that some /other/ filesystem heriarchy
standards suggest that add-on software should be placed in
/opt/package with the executables linked into /opt/bin so only one
more directory had to be added to the path.  We'll never make everyone
happy...  Sun happens to subscribe to this theory, but everybody else
appears to ignore it, which is fine by me.


By the way, there's another possibility on this non-executable script,
if the script got written on a Windoze machine and transferred, it
will have the wrong line endings.  This situation will make the script
non-runnable as a command, but it will still work find called as
"python scriptname" since then only Python has to read the script and
it can handle the line-ending thingy.

Mats Wichmann




More information about the Python-list mailing list