This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients eric.smith, eryksun, paul.moore, steve.dower, tim.golden, uranusjr, zach.ware
Date 2019-11-25.08:21:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574670075.41.0.3240226148.issue38905@roundup.psfhosted.org>
In-reply-to
Content
Yes, it does.

I think we'd need input from Steve Dower here, as these changes were made (I believe) in support of the Windows Store build of Python, so any changes would need to be considered in the light of how they would affect that. I do, however, consider this to be a regression that should be fixed.

BTW, just for completeness,

>>> subprocess.check_output([sys.executable, '-c', 'import sys; print(sys.executable)'])

works as I'd expect, and that's the idiom that is often used. So relying on a path search to find the correct Python can be considered an unusual case (but nevertheless one I'd expect to be fixed).

I assume that the issue here is that the code is being run by the python.dll in the base environment, and whens searching for executables, Windows gives "exes that are in the same directory as the currently executing code" priority over PATH. See https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw, specifically

"""
If the file name does not contain a directory path, the system searches for the executable file in the following sequence:

1. The directory from which the application loaded.
2. The current directory for the parent process.
3. The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
4. The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6. The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.
"""
History
Date User Action Args
2019-11-25 08:21:15paul.mooresetrecipients: + paul.moore, eric.smith, tim.golden, zach.ware, eryksun, steve.dower, uranusjr
2019-11-25 08:21:15paul.mooresetmessageid: <1574670075.41.0.3240226148.issue38905@roundup.psfhosted.org>
2019-11-25 08:21:15paul.moorelinkissue38905 messages
2019-11-25 08:21:14paul.moorecreate