file names longer than MAX_PATH under Windows 2003

Sergey s323 at mail.ru
Tue Feb 14 07:02:48 EST 2006


"Steven D'Aprano" <steve at REMOVETHIScyber.com.au> wrote in message news:pan.2006.02.14.11.43.48.318400 at REMOVETHIScyber.com.au...
> f = file("E:/files/.../something.dat", "r")
> Does this help?

backslashes quoted.

>>> print c
\\.\e:\files\xxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx\xxxxxxxxxxx xxxxxxxxx
\xxxxxxxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxx\xxxxxxxxxxxx
xxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxx\xxxxxx xxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xls

(cyrillic letters in filename here I replaced with x-es)

>>> file(c,"rb")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
IOError: [Errno 2] No such file or directory: u'\\\\.\\e:\\files\\\u041f\u0420....filename skipped....\u0442.xls'

>>> win32file.CreateFile(c,win32file.GENERIC_READ,0,None,win32file.OPEN_EXISTING
,0,None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
pywintypes.error: (206, 'CreateFile', 'The filename or extension is too long.')

When I open explorer, I can browse folder and see this file (but I can do almost nothing with it). It was created through share. 
Ntbackup can work with the file - why Python can't?





More information about the Python-list mailing list