Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more
Mats Wichmann
mats at wichmann.us
Mon Jan 1 12:26:16 EST 2024
On 1/1/24 07:11, Thomas Passin via Python-list wrote:
> Here's how to find out what program Windows thinks it should use to run
> a ".py" file. In a console:
>
> C:\Users\tom>assoc .py
> .py=Python.File
>
> C:\Users\tom>ftype Python.file
> Python.file="C:\Windows\py.exe" "%L" %*
That's not enough. There is now (has been for a while) a layered system,
and this gives you just one layer, there may be other associations that
win out.
Per somebody who actually knows:
> The only way to determine the association without reimplmenting the
shell's search is to simply ask the shell via AssocQueryString. Possibly
PowerShell can provide this information. – Eryk Sun
More information about the Python-list
mailing list