Reinhold Birkenfeld <[EMAIL PROTECTED]> writes:

> Hello,
>
> at the moment python-dev is discussing including Jason Orendorff's path module
> into the standard library.

I have never used the path module before, although I've heard good
things about it.  But, it seems to have problems with unicode pathnames,
at least on windows:

C:\>mkdir späm

C:\späm>py24
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.
>>> from path import path
>>> path.getcwd()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\TSS5\components\_Pythonlib\path.py", line 97, in getcwd
    return path(os.getcwd())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 5: ordinal 
not in range(128)
>>>

Although it seems this could be fixed by adding this constructor to the
path class:

    def __new__(cls, init=u""):
        if isinstance(init, unicode):
            return _base.__new__(cls, init)
        return _base.__new__(cls, init, sys.getfilesystemencoding())

I would really appreciate if Python's unicode support would be better
;-), and maybe it's easier to add this to the path module than to
os.path.

Thomas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to