[New-bugs-announce] [issue17012] Differences between /usr/bin/which and shutil.which()

Serhiy Storchaka report at bugs.python.org
Tue Jan 22 13:14:00 CET 2013


New submission from Serhiy Storchaka:

$ PATH= /usr/bin/which python
$ PATH=: /usr/bin/which python
./python
$ PATH=/usr: /usr/bin/which python
./python

>>> shutil.which('python', path='')
'/usr/bin/python'
>>> shutil.which('python', path=':')
'python'
>>> shutil.which('python', path='/usr:')
'python'

First, I propose interpret path='' as an empty path, not as a default path (we have None for this). However the interpreting of an empty directory in non-empty PATH can be platform-depending.

----------
components: Library (Lib)
messages: 180376
nosy: brian.curtin, hynek, pitrou, serhiy.storchaka, tarek
priority: normal
severity: normal
status: open
title: Differences between /usr/bin/which and shutil.which()
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17012>
_______________________________________


More information about the New-bugs-announce mailing list