[issue6815] UnicodeDecodeError in os.path.expandvars
Alexandr Zamaraev
report at bugs.python.org
Tue Sep 1 10:34:01 CEST 2009
Alexandr Zamaraev <shura_zam at users.sourceforge.net> added the comment:
All code:
[code]
# -*- coding: cp1251 -*-
import os.path
var = r'${APPDATA}\Microsoft\Windows\Start Menu'
print os.path.expandvars(var)
print os.path.expandvars(unicode(var, 'cp1251'))
[/code]
Console session:
[code]
C:\Users\Леново\AppData\Roaming\Microsoft\Windows\Start Menu
Traceback (most recent call last):
File "C:\Lang\test\python\expandvars_bug.py", line 6, in <module>
print os.path.expandvars(unicode(var, 'cp1251'))
File "C:\Lang\Python\26\lib\ntpath.py", line 388, in expandvars
res = res + c
UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 9:
ordinal not in range(128)
[/code]
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6815>
_______________________________________
More information about the Python-bugs-list
mailing list