On Tue, 14 Feb 2006 14:29:44 +0300, Sergey wrote: > Hello. > > I try to open file with pathname length 282 bytes: > E:\files\..................\something.dat > > On MSDN > (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp) > described method to access > files with path length > up to 32000 bytes: 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. May be Python > just doesn't support long unicode filenames? > Is there way to open such files?
Backslashes have special meaning to Python and need to be escaped. If you do this: f = file("E:\files\...\something.dat", "r") Python's string escape rules means you are actually trying to open the file "E:files...something.dat" which doesn't exist. You should escape the backslashes: f = file("E:\\files\\...\\something.dat", "r") or use raw strings: f = file(r"E:\files\...\something.dat", "r") or just use forward slashes and let Windows deal with it: f = file("E:/files/.../something.dat", "r") Does this help? -- Steven. -- http://mail.python.org/mailman/listinfo/python-list