[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix
Jens Diemer
report at bugs.python.org
Fri Feb 5 09:10:28 EST 2016
Jens Diemer added the comment:
I also with this problems.
I have made a test script.
There is a problem with os.chdir(): It doesn't work with \\?\ notation.
And there is also a problem, if you use
```
import os
import pathlib
import tempfile
with tempfile.TemporaryDirectory(prefix="path_test_") as path:
new_path = pathlib.Path(path, "A"*255, "B"*255)
extended_path = "\\\\?\\%s" % new_path
os.makedirs(extended_path)
print(len(extended_path), extended_path)
```
os.makedirs() will work, but the cleanup will failed.
Output is:
```
567 \\?\C:\Users\jens\AppData\Local\Temp\path_test_8fe6utdz\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
Traceback (most recent call last):
File "D:\test2.py", line 18, in <module>
print(len(extended_path), extended_path)
File "C:\Program Files (x86)\Python35-32\lib\tempfile.py", line 807, in __exit__
self.cleanup()
File "C:\Program Files (x86)\Python35-32\lib\tempfile.py", line 811, in cleanup
_shutil.rmtree(self.name)
File "C:\Program Files (x86)\Python35-32\lib\shutil.py", line 488, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Program Files (x86)\Python35-32\lib\shutil.py", line 383, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Program Files (x86)\Python35-32\lib\shutil.py", line 381, in _rmtree_unsafe
os.unlink(fullname)
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: 'C:\\Users\\jens\\AppData\\Local\\Temp\\path_test_8fe6utdz\\AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
```
----------
nosy: +jens
Added file: http://bugs.python.org/file41820/test.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18199>
_______________________________________
More information about the Python-bugs-list
mailing list