New submission from Wator Sead <sea...@gmail.com>:
The current code is: ... if os.path.dirname(cmd): if _access_check(cmd, mode): return cmd return None ... In Windows, if 'cmd' include directory path and not include extension name, it return 'None'. e.g. a file's path is 'd:\dir\app.exe', call shutil.which with 'cmd=="d:\dir\app"'. How about this patch: ... if os.path.dirname(cmd): path, cmd = os.path.split(cmd) ... ---------- components: Library (Lib) messages: 350019 nosy: seahoh priority: normal severity: normal status: open title: [win] shutil.which can not find the path if 'cmd' include directory path and not include extension name type: behavior versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37894> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com