[ python-Bugs-1283895 ] os.path.abspath() / os.chdir() buggy with unicode paths

SourceForge.net noreply at sourceforge.net
Wed Sep 7 14:30:49 CEST 2005


Bugs item #1283895, was opened at 2005-09-07 14:30
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1283895&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Antoine Pitrou (pitrou)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.abspath() / os.chdir() buggy with unicode paths

Initial Comment:
Hi,

Under Windows Explorer, one can create directory names
using characters not belonging to the user locale. For
example, one of our users created a directory named
"C:\Mes Documents\コピー ~ solipsis_svn". 

Unfortunately, when trying to manipulate such a
pathname, os.path.abspath() and os.chdir() don't work
hand in hand. os.path.abspath() uses the garbled
directory name as displayed by the command prompt and
then os.chdir() refuses the path:

C:\>cd "C:\Mes Documents\??? ~ solipsis_svn"

C:\Mes Documents\??? ~ solipsis_svn>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310
32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for
more information.
>>>
>>> import os
>>> os.curdir
'.'
>>> os.path.abspath(os.curdir)
'C:\Mes Documents\??? ~ solipsis_svn'
>>> os.chdir(os.path.abspath(os.curdir))
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 22] Invalid argument: 'C:\Mes
Documents\??? ~ solipsis_svn'
>>>


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1283895&group_id=5470


More information about the Python-bugs-list mailing list