Windows: open() -> "[Errno 38] Filename too long"

Tim Golden mail at timgolden.me.uk
Wed Jun 24 12:43:34 CEST 2009


robert wrote:
> When doing open/os.stat/...(dirpath+filename)
> and total path > 250 chars then
> 
> OSError: "[Errno 38] Filename too long"
> 
> is there a way to access the file without changing to that directory 
> (its in a thread and a fast iteration of many file too) ?

Change filename 

  r"c:\temp\long.txt"

to

  ur"\\?\c:\temp\long.txt"


TJG



More information about the Python-list mailing list