[issue35131] Cannot access to customized paths within .pth file
Windson Yang
report at bugs.python.org
Fri Nov 9 01:58:59 EST 2018
Windson Yang <wiwindson at outlook.com> added the comment:
I tried to create a PR for it, However, I don't know how to handle the code at https://github.com/python/cpython/blob/d4c76d960b/Lib/site.py#L159
So how to check UnicodeDecodeError when we just open the file, I use readlines() but it may use too many memory than before (I'm not sure it's important in this case).
try:
f = open(fullname, "r")
data = f.readlines()
except UnicodeDecodeError:
f = open(fullname, "r", encoding="utf-8")
data = f.readlines()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35131>
_______________________________________
More information about the Python-bugs-list
mailing list