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

R

robert

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=ht...rl=/library/en-us/fileio/fs/naming_a_file.asp
does not work:
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 longTraceback (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
 
D

Dennis Lee Bieber

http://www.google.com/url?sa=D&q=ht...rl=/library/en-us/fileio/fs/naming_a_file.asp

Note that this link (was it necessary to include the google
indirection?) specifies the use of the Unicode variations of functions.
In win32file, the Unicode versions are those with a "W" at the end of
the function name:

GetDriveTypeW() vs GetDriveType() for example; or
CreateFileW() vs CreateFile()

Just adding the prefix string alone doesn't, to my understanding,
cause an automatic usage of the Unicode functions.
does not work:
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.GetFileAttributesW(...)


What can I do?
Well... You can use the Windows Explorer to travel down the
directory to someplace in the middle of the path, then move (drag) the
directory to some top-level on the partition. That may make the rest of
the path short enough to be used.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top