On 3/24/20, Mike Miller <python-id...@mgmiller.net> wrote:
> On 2020-03-24 11:58, Eryk Sun wrote:
>
>> You can manually copy or symlink python.exe to python3.exe in the
>> installation directory and venv "Scripts" directories. However, it
>> will only be used on the command line, and other contexts that search
>> PATH. Currently the launcher will not use it with a virtual "env"
>> shebang. The launcher will search PATH for "python", but not
>> "python3".
>
> Thanks.  Sure, there are many ways to fix this manually, or work around it.

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".

I'd also prefer the env search to check the user and system "App
Paths" key [1] if the name isn't found in PATH. Each subkey of "App
Paths" is the name of a command such as "python3.exe", for which the
fully-qualified executable filename is the key's default value. This
is the Windows shell API equivalent of creating symlinks in
"~/.local/bin" and "/usr/bin" on Unix systems. ShellExecuteExW checks
"App Paths", but the launcher has to use CreateProcessW, which is
beneath the shell API.

> Would be great if it was consolidated, with one command "to rule them all."

I'm in favor of "py" becoming the cross-platform command to run Python
from the command line, since there's already a lot of inertia in that
direction on Windows. Brett Cannon is working on a Unix version [2].

[1]: 
https://docs.microsoft.com/en-us/windows/win32/shell/app-registration#using-the-app-paths-subkey
[2]: https://crates.io/crates/python-launcher
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VHHZ263OEMNISHMBTPPTC7OVYJNA4KIO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to