[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix

Eryk Sun report at bugs.python.org
Wed Feb 10 22:02:37 EST 2016


Eryk Sun added the comment:

> There is a problem with os.chdir(): It doesn't work with
> \\?\ notation.

The process current directory is part of the Windows API, so it's subject to the MAX_PATH limit [1]. See SetCurrentDirectory [2]. Python can't do anything about this. 

As to shutil.rmtree, I agree it's an example of why the Windows path-length problem needs to be addressed more generally. Maybe there could be a __path__ special method supported by pathlib paths. On Windows this could resolve to an absolute path prefixed with "\\?\".

[1]: Native NT relative paths are relative to a handle in the 
     OBJECT_ATTRIBUTES record that's used to create or open an 
     object. This isn't generally exposed in the Windows API, 
     except in the registry API.
[2]: https://msdn.microsoft.com/en-us/library/aa365530

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18199>
_______________________________________


More information about the Python-bugs-list mailing list