Filename Too Long

Brian Quinlan brian at sweetapp.com
Fri Apr 5 13:03:07 EST 2002


Peter wrote:
> I'm using windows and trying to call os.path.getmtime() after using
> os.path.walk... However, I'm choking with "[Errno 38] Filename too
> long" on paths with len > ~260
> 
> Is there any way around this error?

I assume that you are using absolute paths? If that is the case then you
can work around this problem by changing directories (os.chdir) and
using relative paths e.g.

file = r'c:\200chardirectoryname\200charfilename'
os.chdir(r'c:\200chardirectoryname')
os.path.getmttime('200charfilename')

Cheers,
Brian






More information about the Python-list mailing list