Alexandr Zamaraev <shura_...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue6815>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to