Filename too long error

Tim Golden Tim.Golden at viacom-outdoor.co.uk
Tue Dec 5 03:57:18 EST 2006


[Moqtar]

| I am trying to walk a directory and print the file and its modified
| time. When the path is longer then 259 characters i get an error
| "Filename too long". I guess these is because windows limitation on
| path length.
| 
| My code:
| 

[... snip code ...]

| 
| Traceback (most recent call last):
|   File "C:\Python24\hello.py", line 17, in -toplevel-
|     ModifiedTime=os.path.getmtime(fullpath)
|   File "C:\Python24\lib\ntpath.py", line 233, in getmtime
|     return os.stat(filename).st_mtime
| OSError: [Errno 38] Filename too long
| 
| Is there a way to find the modified time of long path?

There was a thread on similar lines a while back:

http://tinyurl.com/y2tfoh (points to Google Groups)

In short, Python 2.5 now uses the Win32 API which
allows for longer names; until then you might have
to call it yourself directly, which is not too onerous.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list