New submission from Ben Spiller <spiller....@gmail.com>:
The py.exe launcher doc states "If no relevant options are set, the commands python and python2 will use the latest Python 2.x version installed" ... which was indeed working reliably until Microsoft added their weird python.exe shim (which either terminates with no output or brings up the Microsoft Store page) as part of https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update/ Now, I find scripts that start with "#!/usr/bin/env python" cause py.exe to run the Windows python.exe shim which confusingly terminates with no output (unless run with no arguments). I think to stop lots of developers banging theirs heads against this brick wall, py.exe should include some logic to ignore the C:\Users\XXX\AppData\Local\Microsoft\WindowsApps\python.exe shim, since for someone with py.exe installed, running that is _never_ what you'd want. (or alternatively, work with Microsoft to get this decision reversed, but that may be harder!) Lots of people are hitting this e.g. https://superuser.com/questions/1437590/typing-python-on-windows-10-version-1903-command-prompt-opens-microsoft-stor , https://stackoverflow.com/questions/57485491/python-python3-executes-in-command-prompt-but-does-not-run-correctly Here's the output: py myscript.py launcher build: 32bit launcher executable: Console File 'C:\Users\XXX\AppData\Local\py.ini' non-existent Using global configuration file 'C:\WINDOWS\py.ini' Called with command line: apama-build\build.py -h maybe_handle_shebang: read 256 bytes maybe_handle_shebang: BOM not found, using UTF-8 parse_shebang: found command: python searching PATH for python executable Python on path: C:\Users\XXX\AppData\Local\Microsoft\WindowsApps\python.exe located python on PATH: C:\Users\XXX\AppData\Local\Microsoft\WindowsApps\python.exe run_child: about to run 'C:\Users\XXX\AppData\Local\Microsoft\WindowsApps\python.exe myscript.py' child process exit code: 9009 >py -0 Installed Pythons found by py Launcher for Windows -3.8-64 * -3.7-64 -3.6-64 -2.7-64 (nb: was surprising that it didn't run any of those installed versions!) ---------- components: Windows messages: 369379 nosy: benspiller, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: Windows py.exe launcher interacts badly with Windows store python.exe shim versions: Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40687> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com