[New-bugs-announce] [issue3426] os.path.abspath with unicode argument should call os.getcwdu
Christian Häggström
report at bugs.python.org
Tue Jul 22 16:32:13 CEST 2008
New submission from Christian Häggström <chn at virtutech.com>:
If current working directory contains non-ascii characters, calling
os.path.abspath(u".") will result in an error. I expect it to call the
underlying os.getcwdu() in this case.
>>> import os
>>> os.path.abspath(u".")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/packages/python-2.5.1/x86-linux/lib/python2.5/posixpath.py", line
403, in abspath
path = join(os.getcwd(), path)
File
"/home/packages/python-2.5.1/x86-linux/lib/python2.5/posixpath.py", line
65, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 29:
ordinal not in range(128)
It works if I do it manually, using os.getcwdu():
>>> os.path.join(os.getcwdu(), u".")
u'/disk1/chn_local/work/test/sk\xe4rg\xe5rds\xf6-latin1/.'
----------
components: Unicode
messages: 70148
nosy: saturn_mimas
severity: normal
status: open
title: os.path.abspath with unicode argument should call os.getcwdu
type: behavior
versions: Python 2.4, Python 2.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3426>
_______________________________________
More information about the New-bugs-announce
mailing list