Message378909
> For platform semantics, I'd prefer a link to the CreateProcessW docs,
> with advice to read about the lpApplicationName parameter with
> respect to `executable` and lpCommandLine with respect to `args`
> and the platform search semantics.
For example, let's help someone figure out that because "python3.8" has a ".8" filename 'extension', ".exe" may or may not be appended in a search.
>>> print(shutil.which('python3.8'))
C:\Users\someone\AppData\Local\Microsoft\WindowsApps\python3.8.EXE
>>> subprocess.call(['python3.8.exe', '-V'])
Python 3.8.6
0
SearchPathW (called internally by CreateProcessW) won't append the ".exe" default extension to a name that already has a ".8" extension:
>>> try: subprocess.call(['python3.8', '-V'])
... except OSError as e: print(e)
...
[WinError 2] The system cannot find the file specified
But with shell=True it works because CMD always appends the PATHEXT extensions (thankfully there isn't a "python3.8.com" file to get in the way, since .COM is usually listed before .EXE in PATHEXT):
>>> subprocess.call('python3.8 -V', shell=True)
Python 3.8.6
0
SearchPathW does append the default ".exe" extension for a qualified path:
>>> subprocess.call([r'C:\Users\someone\AppData\Local\Microsoft\WindowsApps\python3.8', '-V'])
Python 3.8.6
0 |
|
Date |
User |
Action |
Args |
2020-10-18 22:46:05 | eryksun | set | recipients:
+ eryksun, paul.moore, vinay.sajip, tim.golden, docs@python, zach.ware, steve.dower, gaborjbernat, keller00 |
2020-10-18 22:46:05 | eryksun | set | messageid: <1603061165.22.0.657466299753.issue42041@roundup.psfhosted.org> |
2020-10-18 22:46:05 | eryksun | link | issue42041 messages |
2020-10-18 22:46:05 | eryksun | create | |
|