[issue13247] os.path.abspath returns unicode paths as question marks
STINNER Victor
report at bugs.python.org
Sun Oct 23 11:19:48 CEST 2011
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
abspath() is implemented using nt._getfullpathname() which calls GetFullPathNameA().
> The returned path with question marks is completely useless.
Can you open the file using such filename? If no, I agree that the result is useless.
> It's better that python throw an error than return the question marks.
Python is currently a thin wrapper on the Windows API. Windows doesn't consider that a filename with question marks as an error.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364963%28v=vs.85%29.aspx
Python can maybe uses GetFullPathNameW() and encode manually the filename using its strict MBCS codec. MBCS codec is strict since Python 3.2: it raises a UnicodeEncodeError if the string cannot be encoded.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13247>
_______________________________________
More information about the Python-bugs-list
mailing list