On 3/25/20, Steve Barnes <gadgetst...@live.co.uk> wrote:
>> Except it's not necessarily what the original post wants. The OP wants the
>> shebang "#!/usr/bin/env python3" to "work everywhere by
>> default", for which I assume it's implied that it should work consistently
>> everywhere. I'd prefer for the launcher's env search to also
>> support versioned "pythonX[.Y][-32|-64]" commands such as "python3".
> The windows launcher already does support this with shebangs of:
> #!/usr/bin/env python3 # Launch with the latest/preferred version of python3
> #!/usr/bin/env python2 # Launch with the latest/preferred version of python2

That is not consistent with Unix. env is supposed to search PATH for
the command. However, the launcher does not search PATH for a
versioned command such as "python3". Instead it uses the highest
version that's registered for 3.x or 2.x, respectively, or the version
set by PY_PYTHON3 or PY_PYTHON2 if defined, respectively.

> #!/usr/bin/env python # Launch with the latest/preferred version of python 2
> unless PY_PYTHON=3[.n[-64/32]] is set or py.ini has the same in.

In this case "env" first searches PATH before falling back on
registered installations and PY_PYTHON, which is correct -- at least
for the PATH search. I would prefer that "env" never checks registered
installations. For the registry fallback, it should instead check the
user and system "App Paths" key, like what ShellExecuteExW does.
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
Message archived at 
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to