os.path.getmtime on windows, error: 206 - path or extension too long

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Jan 22 23:17:22 CET 2009

En Wed, 21 Jan 2009 08:50:53 -0200, mynthon <mynthon1 at gmail.com> escribió:

> I have very long path on windows and i get error when try to get
> modification time. So i tried do chdir path and then get file. It now
> gives me error that file doesn't exists
> it works for other files so i suppose it is not my fault. I know there
> is a win32 module but i can't find any documentation for it (what is
> the purpose to create app without docs?). Any idea?

win32api is part of the pywin32 package, available at http://pywin32.sf.net
This is not a Python standard package - you either installed it yourself  
some time ago (and forgot about it) or perhaps you're using the Enthought  
bundle (which includes pywin32 and PythonWin). Either way, you surely have  
the PyWin32.chm help file installed too.

En Wed, 21 Jan 2009 12:11:03 -0200, mynthon <mynthon1 at gmail.com> escribió:

> you can also use \\?\ prefix but ONLY FOR unicode strings
> os.path.getmtime("\\\\?\\c:\\very lon path\\blablabla") #will not work
> os.path.getmtime(u"\\\\?\\c:\\very lon path\\blablabla") #will work

Looks like you found the "official" answer to your problem. Notice that  
the path must be "normalized" in this case - that means, it must not  
contain "." nor ".." components.

Gabriel Genellina

More information about the Python-list mailing list