[issue32921] .pth files cannot contain folders with utf-8 names

2018-03-05 Thread Steve Dower

Steve Dower  added the comment:

Yes, it'll have significant side effects. The default file encoding on Windows 
is your configured code page (1252, in your case), and there's no good way 
around that default. The easiest immediate fix is to re-encode that file 
yourself.

Perhaps what we could do instead is allow the first line of a .pth file to be a 
coding comment? Then site.py can reopen the file with the specified encoding.

(FWIW, when I added the ._pth file, I explicitly made it UTF-8. But it had no 
history at that time so it was safe to do so.)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32921] .pth files cannot contain folders with utf-8 names

2018-03-04 Thread R. David Murray

Change by R. David Murray :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32921] .pth files cannot contain folders with utf-8 names

2018-02-23 Thread Einar Fredriksen

New submission from Einar Fredriksen :

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 

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 


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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com