206 The filename or extension is too long / OSError: [Errno 38] Filename too long

robert no-spam at no-spam-no-spam.com
Sat Jul 1 06:32:09 EDT 2006


e.g. open/os module functions (os.path.getmtime...) and 
win32api/win32file functions fail on long paths (>~255 chars)

even the '\\?\' trick from 
http://www.google.com/url?sa=D&q=http://msdn.microsoft.com/library/default.asp%3Furl%3D/library/en-us/fileio/fs/naming_a_file.asp
does not work:

 >>> os.path.getmtime('\\\\?\\'+fabs)
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
   File "C:\PYTHON23\lib\ntpath.py", line 232, in getmtime
     return os.stat(filename).st_mtime
OSError: [Errno 38] Filename too long
 >>>

 >>> win32api.GetFileAttributes('\\\\?\\'+fabs)
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
error: (206, 'GetFileAttributes', 'Der Dateiname oder die Erweiterung 
ist zu lang.')
 >>>

(='206 The filename or extension is too long')

What can I do?


-robert



More information about the Python-list mailing list