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 eryksun
Recipients Alexander.Todorov, dstufft, eric.araujo, eryksun
Date 2020-10-07.13:12:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602076326.63.0.427679303173.issue41965@roundup.psfhosted.org>
In-reply-to
Content
The existing behavior of find_executable() is unusual compared to a native Windows file search via CreateProcessW or SearchPathW, for which a default ".exe" extension is appended only if the executable name doesn't already have an extension. (CreateProcessW supports searching for a file that has no extension by adding a trailing dot to the name, which in Windows is equivalent to the name without the trailing dot.) 

However, I don't think it's prudent to change the default behavior of this old code, especially since there are plans to deprecate distutils per PEP 632. It's recommended to migrate existing code to use shutil.which() and subprocess.run(). 

There are open issues to improve the behavior of shutil.which() in Windows. For example, currently it's limited to PATHEXT extensions, which is a generalization of how find_executable() works with ".exe". shutil.which() won't find "rst2man.py" if ".PY" isn't in PATHEXT. The proper behavior, if the CMD shell is the standard of correctness, is to include the exact name as the first candidate to check before trying the name plus the PATHEXT extensions. To be more like the CMD shell, a name without an extension should be excluded, but effectively included anyway if PATHEXT contains a "." entry.
History
Date User Action Args
2020-10-07 13:12:06eryksunsetrecipients: + eryksun, eric.araujo, dstufft, Alexander.Todorov
2020-10-07 13:12:06eryksunsetmessageid: <1602076326.63.0.427679303173.issue41965@roundup.psfhosted.org>
2020-10-07 13:12:06eryksunlinkissue41965 messages
2020-10-07 13:12:06eryksuncreate