Author bobjalex
Recipients bobjalex
Date 2015-06-24.22:09:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1435183779.2.0.13075721906.issue24505@psf.upfronthosting.co.za>
In-reply-to
Content
Python session with 3.5b2

Showing existing error:
>>> from shutil import which

Works OK
>>> which("python")
'C:\\Python27\\python.EXE'

Also works OK
>>> which('C:\\Python27\\python.EXE')
'C:\\Python27\\python.EXE'

Fails
>>> which('C:\\Python27\\python')
>>>

Showing better results with my fix (attached):
>>> from which2 import which
>>> which("python")
'C:\\Python27\\python.exe'
>>> which('C:\\Python27\\python.exe')
'C:\\Python27\\python.exe'
>>> which('C:\\Python27\\python')
'C:\\Python27\\python.exe'

Problem is with the short-circuiting code near the beginning of the function. It fails to check the extensions for Windows when short-circuited.

My fix has a few other improvements -- efficiency and nicer output without those ugly upper-case extensions.
History
Date User Action Args
2015-06-24 22:09:39bobjalexsetrecipients: + bobjalex
2015-06-24 22:09:39bobjalexsetmessageid: <1435183779.2.0.13075721906.issue24505@psf.upfronthosting.co.za>
2015-06-24 22:09:39bobjalexlinkissue24505 messages
2015-06-24 22:09:39bobjalexcreate