New submission from Arfrever Frehtes Taifersar Arahesis: shutil.which() should support bytes. Some other functions in shutil module support bytes.
>>> shutil.which("echo") '/bin/echo' >>> shutil.which(b"echo") >>> >>> Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.3/shutil.py", line 1126, in which name = os.path.join(dir, thefile) File "/usr/lib64/python3.3/posixpath.py", line 92, in join "components.") from None TypeError: Can't mix strings and bytes in path components. >>> shutil.which("echo", path="/bin") '/bin/echo' >>> shutil.which("echo", path=b"/bin") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.3/shutil.py", line 1098, in which path = path.split(os.pathsep) TypeError: Type str doesn't support the buffer API >>> shutil.which(b"echo", path=b"/bin") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python3.3/shutil.py", line 1098, in which path = path.split(os.pathsep) TypeError: Type str doesn't support the buffer API ---------- components: Library (Lib) messages: 191644 nosy: Arfrever, hynek, tarek priority: normal severity: normal status: open title: shutil.which() should support bytes versions: Python 3.3, Python 3.4 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18283> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com