[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray
Changes by R. David Murray : -- resolution: -> invalid status: open -> closed type: -> behavior ___ Python tracker ___ ___ Python-bu

[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread Pascal Garcia
Pascal Garcia added the comment: Sorry for this error. Thanks for the solution. Here is the code as I modify it. wrkdir= os.path.expanduser("~"+os.sep) loc = locale.getdefaultlocale() if loc[1]: encoding = loc[1] wrkdir= wrkdir.

[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray
R. David Murray added the comment: On linux as well this fails: os.path.expanduser(u'~' + os.sep) But this works: os.path.expanduser('~' + os.sep) Counterintuitive, to say the least. The reason is that the value of the HOME environment variable is read as a byte string, but when that by

[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread Pascal Garcia
Pascal Garcia added the comment: Here are 2 logs one with the default site.py forcing defaultencoding to ascii, and the other to utf8. You can see that the home dir includes accents : Pépé Not an insult to anybody but this stupid computer :) When I force using the locale.getdefaultlocale() as

[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray
R. David Murray added the comment: Also, it would be helpful for you to show a full traceback, since there can be spurrious sources of unicode errors on Windows depending on how you execute your code. -- ___ Python tracker

[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread R. David Murray
R. David Murray added the comment: I could not reproduce this error on Linux with python2.7. -- nosy: +haypo, r.david.murray ___ Python tracker ___ __

[issue18171] os.path.expanduser does not use the system encoding

2013-06-09 Thread Pascal Garcia
New submission from Pascal Garcia: The name of the user contains accents under windows. This error occurs when using the function. expaduser("~") UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 10: ordinal not in range(128) ascii is the default encoding as sys.getdefaulte