file names longer than MAX_PATH under Windows 2003
Tim Golden
tim.golden at viacom-outdoor.co.uk
Tue Feb 14 06:43:34 EST 2006
[Sergey]
| I try to open file with pathname length 282 bytes:
| E:\files\..................\something.dat
| [... MS advise ...] just add prefix \\?\ to file name.
| But when I try to pass prefixed name to file(), I get the
| same result as when I don't add the prefix: file not found.
With a file called c:\temp\test.txt, I successfully
opened and read it like this:
print open (r"\\?\C:\temp\test.txt").read ()
So the basic functionality works. I didn't
artificially generate a long path to see if
there's a problem in that direction.
But note that r prefix to the string. Is it possible
that your string didn't include it? If not, then the
backslash character which Windows uses as a separator
can be stolen by Python which sees it as an escaping
character.
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