New submission from Bob Alexander: 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. ---------- components: Library (Lib) files: which2.py messages: 245780 nosy: bobjalex priority: normal severity: normal status: open title: shutil.which wrong result on Windows type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file39805/which2.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24505> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com