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.

classification
Title: shutil.which: does not find path/cmd.ext where ext is not given
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: duplicate
Dependencies: Superseder: shutil.which wrong result on Windows
View: 24505
Assigned To: Nosy List: eryksun, michael2
Priority: normal Keywords: patch

Created on 2021-05-31 02:15 by michael2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26458 closed michael2, 2021-05-31 02:19
Messages (3)
msg394784 - (view) Author: Michael Hirsch, Ph.D. (michael2) Date: 2021-05-31 02:15
The early short-circuit logic in shutil.which() when cmd includes a directory component incorrectly gives None on Windows if the correct filename suffix was not also given.

Example: on Windows if ./foo.exe exists, then shutil.which('./foo.exe') returns None.
msg394785 - (view) Author: Michael Hirsch, Ph.D. (michael2) Date: 2021-05-31 02:23
Correction:

Example: on Windows if ./foo.exe exists, then shutil.which('./foo') returns None.
msg394786 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-05-31 02:51
Michael, thank you for the PR, but please associate it with the existing issue bpo-24505.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88436
2021-05-31 02:51:06eryksunsetstatus: open -> closed

superseder: shutil.which wrong result on Windows
versions: - Python 3.6, Python 3.7, Python 3.8
nosy: + eryksun

messages: + msg394786
resolution: duplicate
stage: patch review -> resolved
2021-05-31 02:23:04michael2setmessages: + msg394785
2021-05-31 02:19:28michael2setkeywords: + patch
stage: patch review
pull_requests: + pull_request25053
2021-05-31 02:15:53michael2create