[issue12420] distutils crashes if PATH is not defined
report at bugs.python.org
Mon Jun 27 17:17:58 CEST 2011
Henry Precheur <henry at precheur.org> added the comment:
I think that returning None would be a better option. The function
Tries to find 'executable' in the directories listed in 'path'.
A string listing directories separated by 'os.pathsep'; defaults to
os.environ['PATH']. Returns the complete filename or None if not found.
If os.environ['PATH'] is empty the function returns None:
>>> from distutils.spawn import find_executable
>>> find_executable('does not exist', path='/bin:/usr/bin') is None
>>> find_executable('test', path='') is None
This would be consistent with the function definition. If PATH is
undefined, the executable cannot be found, therefor returning None seems
like the right thing to do.
On Mon, Jun 27, 2011 at 02:33:09PM +0000, ??ric Araujo wrote:
> ??ric Araujo <merwok at netwok.org> added the comment:
> Okay, I see the original use case (#12401). I think the proper thing to do is to skip tests that rely on the environment being non-empty.
> Python tracker <report at bugs.python.org>
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list