I read here, here, and here about how to get python (2.x) working with long paths on Windows. On the other hand, this post comes to the conclusion that it is not possible with Python 2.7.
My setup:
- Windows Server 2016 Version
1607
build14393.969
- The
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem\LongPathsEnabled
andHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
registry keys are to1
and I rebooted - Python 2.7 64 bit
The code I am struggling with is this:
my_long_path = u'\\\\?\\c:\\Users\\asdf\\Desktop\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\'
os.makedirs(my_long_path)
Traceback (most recent call last):
Python Shell, prompt 132, line 1
File "c:\Python27\Lib\os.py", line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: u'\\\\?\\c:\\Users\\..
- Is it possible to work with long paths on Windows 2016 and Python 2.7?
- Is it possible with Windows 2016 Server and Python 3.7?
- Is it possible with Windows 10 and Python 2.7?
- Is it really possible with Windows 10 and Python 3.7 (as indicated in one of the above mentioned post)?