[Python-bugs-list] [ python-Bugs-567374 ] os.stat() can't handle unicode filenames
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 11 Jun 2002 05:33:59 -0700
Bugs item #567374, was opened at 2002-06-11 13:08
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=567374&group_id=5470
Category: Python Library
Group: Python 2.1.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Andy Jewell (cybervegan)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.stat() can't handle unicode filenames
Initial Comment:
OS: Windows NT(WP)
Idle version info string: "Python 2.1.3 (#35, Apr 8 2002,
17:47:50) [MSC 32 bit (Intel)] on win32"
Error Message: "OSError: [Errno 2] No such file or
directory: 'r:/doobery\xa3.FM3' "
Any calls with filenames containing unicode characters
to os.* library functions that in turn use os.stat() fail
with 'Fiile or directory does not exist' errors.
This happens on local drives, windows shares and novell
mapped drives, and seems to afflict even DOS 8.3
filenames.
For example, the pound stirling sign (£) causes this
problem.
I've tried tracing module os through to the stat()
definition, but found that it's in a module named nt,
which I can't find!
----------------------------------------------------------------------
>Comment By: Andy Jewell (cybervegan)
Date: 2002-06-11 13:33
Message:
Logged In: YES
user_id=561310
This is not a bug.
Binary floating point cannot represent decimal fractions exactly,
so some rounding always occurs (even in Python 1.5.2).
What changed is that Python 2.0 shows more precision than before
in certain circumstances (repr() and the interactive prompt).
You can use str() or print to get the old, rounded output:
>>> print 0.1+0.1
0.2
>>>
Follow the link for more information:
http://www.python.org/doc/2.2.1/tut/node14.html
----------------------------------------------------------------------
Comment By: Andy Jewell (cybervegan)
Date: 2002-06-11 13:33
Message:
Logged In: YES
user_id=561310
Further investigation reveals that it's probably NOT a unicode
problem - \xa3 is the escaped encoding for ASCII character
163, the £ symbol.
Maybe stat is just not converting escapes to their character
equivalents?
Maybe os.path.listdir() shouldn't be escape-encoding non-
ascii characters?
MAYBE USERS SHOULDN'T USE DUMB FILENAMES :-)
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=567374&group_id=5470