[New-bugs-announce] [issue18283] shutil.which() should support bytes
Arfrever Frehtes Taifersar Arahesis
report at bugs.python.org
Sat Jun 22 17:29:11 CEST 2013
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 <report at bugs.python.org>
<http://bugs.python.org/issue18283>
_______________________________________
More information about the New-bugs-announce
mailing list