[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Understanding PATH$ variable



Hi,

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.

man 1 python does not look as if it is intended that you install some
PATH-interpreting module before the script file gets opened.
I was tempted to propose double-shell:

  python "$(which script.py)"

but that's not really a substitute for the simplicity of PATH in sh.


One could start custom scripts via shebang rather than via a direct run
of /usr/bin/python:
  https://stackoverflow.com/questions/6908143/should-i-put-shebang-in-python-scripts-and-what-form-should-it-take
In this case the shell parser would use PATH as expected by Richard:

  script.py


Have a nice day :)

Thomas


Reply to: