[docs] [issue23904] pathlib.PurePath does not accept bytes components
Antoine Pitrou
report at bugs.python.org
Sun Apr 12 00:02:08 CEST 2015
Antoine Pitrou added the comment:
Interesting. The doc is wrong here: pathlib was designed so that it only accepts text strings.
> If I use "surrogateescape" (see PEP383) how can I display the
> fake-unicode path to the user? `print()` does seems to use strict
> encoding. Should I encode it with "surrogateescape" or "ignore" myself
> beforehand?
Yes, you should probably encode it yourself. If you are sure your terminal can eat the original bytestring, then use "surrogateescape". Otherwise, "replace" sounds better so that the user knows there are some undecodable characters out there.
----------
nosy: +ncoghlan, pitrou
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23904>
_______________________________________
More information about the docs
mailing list