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 vstinner
Recipients christian.heimes, giampaolo.rodola, gregory.p.smith, izbyshev, vstinner
Date 2019-01-17.09:22:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1547716948.7.0.62413959313.issue35755@roundup.psfhosted.org>
In-reply-to
Content
I'm working on PR but I found an issue.

shutil.which() behaves differently than subprocess, distutils.spawn.find_executable() and os.execv() when PATH is set but set to an empty string:

* os.get_exec_path() returns ['']
* shutil.which() returns None: DON'T RUN
* subprocess RUNS the program
* distutils.spawn.find_executable('program') returns 'program': RUN the program
* os.execv() RUNS the program

Using PATH=":", they all run the program and os.get_exec_path() returns ['', ''].

Who is right? Which behavior do we want for Python?

Note: When PATH is set to an empty string, shutil.which() and distutils.spawn.find_executable() use the empty string, they don't use os.defpath.
History
Date User Action Args
2019-01-17 09:22:29vstinnersetrecipients: + vstinner, gregory.p.smith, giampaolo.rodola, christian.heimes, izbyshev
2019-01-17 09:22:28vstinnersetmessageid: <1547716948.7.0.62413959313.issue35755@roundup.psfhosted.org>
2019-01-17 09:22:28vstinnerlinkissue35755 messages
2019-01-17 09:22:28vstinnercreate