[issue40687] Windows py.exe launcher interacts badly with Windows store python.exe shim

2020-05-19 Thread Steve Dower


Steve Dower  added the comment:

If someone remembers where the other "shebangs on Windows don't make sense" 
issue is, I think we can close this one in favour of that.

Though it's also an important point for issue40667 - if "python.exe" becomes 
the launcher, then this will get stuck in an infinite loop (and process memory 
exhaustion is the worst kind of hang on Windows).

--
versions: +Python 3.10, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40687] Windows py.exe launcher interacts badly with Windows store python.exe shim

2020-05-19 Thread Ben Spiller


Change by Ben Spiller :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40687] Windows py.exe launcher interacts badly with Windows store python.exe shim

2020-05-19 Thread Ben Spiller


New submission from Ben Spiller :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com