Message146322
An example error with abspath and bytes input:
>>> os.path.abspath('.')
'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5'
>>> os.path.abspath(b'.')
b'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??????'
>>> os.listdir(os.path.abspath(b'.'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??????/*.*'
>>>
I couldn't follow the implementation, I got stuck not being able to locate the definition for os.getcwdb so I couldn't join you for that part. Here's another possible solution:
>>> win32api.GetFullPathName('.')
'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5'
>>> win32api.GetShortPathName(win32api.GetFullPathName('.'))
'C:\\Users\\yuv\\Desktop\\YUVDES~1\\5F30~1'
The short path is ascii but the problem is not all windows file systems have 8.3 filenames [1]. So I think your suggestion is the best solution.
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#short_vs._long_names |
|
Date |
User |
Action |
Args |
2011-10-24 19:51:40 | ubershmekel | set | recipients:
+ ubershmekel, vstinner |
2011-10-24 19:51:40 | ubershmekel | set | messageid: <1319485900.27.0.175540709121.issue13247@psf.upfronthosting.co.za> |
2011-10-24 19:51:39 | ubershmekel | link | issue13247 messages |
2011-10-24 19:51:38 | ubershmekel | create | |
|