On Mon, Sep 23, 2019 at 06:56:47PM +0200, Thomas Schmitt wrote:
> Greg Wooledge wrote:
> > I'd be rather surprised if there's *no* function in Python that uses
> > the PATH variable.
> 
> Problem is that Richard Owlett expected it to work in the starter program
> of the interpreter (here: /usr/bin/python) when it opens the script file
> for reading. I assume Python developers consider this too much of Silly Walks.

If it's about shebangs, the most widely respect authority is Sven
Mascheck's page <http://www.in-ulm.de/~mascheck/various/shebang/>.

In a nutshell, the shebang should be a full path to a program.  If one
doesn't wish to hard-code the path to python, this is an acceptable
hack:

#!/usr/bin/env python

This relies on the real-world knowledge that env(1) is virtually always
in /usr/bin, on every unix-based system.  env(1) will search PATH to
find a program named "python" and exec (chain-load) it.

If a script is only intended to run on Debian, or more specifically,
if it's only intended to run on *one* particular Debian system (his),
hard-coding the path to python would be preferred.  There's no reason
to introduce the /usr/bin/env hack in that case.

For any questions about writing Python scripts, portability of Python
script shebangs, etc., he should ask a Python mailing list.

Reply via email to