This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: under Windows XP, os.walk problem with path >256? chars
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, mkc, nnorwitz
Priority: normal Keywords:

Created on 2006-06-12 20:34 by mkc, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg28788 - (view) Author: Mike Coleman (mkc) Date: 2006-06-12 20:34
Under Windows XP, when using os.walk to walk a tree, I
get an error message for a path of 256+ characters.

The error looks like 

error listing directory [[Errno 206] The filename or
extension is too long: <omitted>

The path in question is 12 directories deep, if that
matters.  The Windows 'dir' command also doesn't like
this path because of its length, but it seems like
there ought to be a way to walk it.

msg28789 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-06-13 08:34
Logged In: YES 
user_id=33168

I'm not sure, but this may have been fixed in Python 2.5. 
There should be a shiny new beta coming out in the next
couple of days.  I believe alpha 2 also has the fix
(assuming that beta 1 has it and I'm not remembering some
other change).
msg28790 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-06-13 17:16
Logged In: YES 
user_id=21627

First of all, it's a limitation of the Microsoft C library
that you are running into; that limitation should be removed
in Python 2.5, so I'm closing this as "fixed".

However, that might only mean that you get a different
error: The Windows API is also normally limited to MAX_PATH
characters, which is 260 (including drive letter).

The only exception to get around that limit is to use
Unicode path names that are \\?\ escaped, see

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43491
2006-06-12 20:34:24mkccreate