[New-bugs-announce] [issue32921] .pth files cannot contain folders with utf-8 names
Einar Fredriksen
report at bugs.python.org
Fri Feb 23 08:03:18 EST 2018
New submission from Einar Fredriksen <einaren at gmail.com>:
Add "G:\русский язык" to a pth file and start python. it fails with
--------------
Failed to import the site module
Traceback (most recent call last):
File "C:\Program Files\ROXAR\RMS dev_release\windows-amd64-vc_14_0-release\bin\lib\site.py", line 546, in <module>
main()
File "C:\Program Files\ROXAR\RMS dev_release\windows-amd64-vc_14_0-release\bin\lib\site.py", line 532, in main
known_paths = addusersitepackages(known_paths)
File "C:\Program Files\ROXAR\RMS dev_release\windows-amd64-vc_14_0-release\bin\lib\site.py", line 287, in addusersitepackages
addsitedir(user_site, known_paths)
File "C:\Program Files\ROXAR\RMS dev_release\windows-amd64-vc_14_0-release\bin\lib\site.py", line 209, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Program Files\ROXAR\RMS dev_release\windows-amd64-vc_14_0-release\bin\lib\site.py", line 165, in addpackage
for n, line in enumerate(f):
File "C:\Program Files\ROXAR\RMS dev_release\windows-amd64-vc_14_0-release\bin\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 8: character maps to <undefined>
----------------
This might very well have sideeffects, but adding "encoding='utf-8'" to the open() call in site.py def addpackage seems to fix the issue for me
----------
components: Unicode
messages: 312635
nosy: einaren, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: .pth files cannot contain folders with utf-8 names
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32921>
_______________________________________
More information about the New-bugs-announce
mailing list