[issue20140] UnicodeDecodeError in ntpath.py when home dir contains non-ascii signs

honglei jiang report at bugs.python.org
Tue May 27 19:16:23 CEST 2014


honglei jiang added the comment:

Python:canopy-1.3.0.1715.win-x86_64\
OS:Win8.1 64

>>>directory
'F:\\Flask\\EmberJS\\\xd6\xd0\xce\xc4\\Prj\\static'
>>>os.path.isdir(directory)
True
>>>filename
u'todomvc/architecture-examples/angularjs/index.html'
>>>os.path.join(directory,filename)
Traceback (most recent call last):
  File "c:\Users\honglei\AppData\Local\Enthought\Canopy\User\Lib\site-packages\flask\helpers.py", line 1, in <module>
    # -*- coding: utf-8 -*-
  File "C:\Users\honglei\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.3.0.1715.win-x86_64\Lib\ntpath.py", line 108, in join
    path += "\\" + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd6 in position 17: ordinal not in range(128)

>>>f=os.path.join(directory.decode(sys.getfilesystemencoding()),filename)
>>>os.path.isfile(f)
True

----------
nosy: +jhonglei

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20140>
_______________________________________


More information about the Python-bugs-list mailing list