Python和Windows 10最大路径长度

时间:2018-07-02 19:54:58

标签: python windows

Python 2.7.4中是否存在设置以在Windows 10上启用长文件名处理?

在Computer \ HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ FileSystem下的注册表中,我看到LongPathsEnabled的标志设置为1或true。

我发现我能够从CMD外壳将文件复制到新位置,该外壳创建的总路径长度超过260。

但是在python 2.7脚本中,当试图打开文件以使其路径太长而无法写入时,会出现以下错误:

error in write
    file = open(path, 'w')
IOError: [Errno 2] No such file or directory: "c:\\..."

可能还有其他问题,但是创建路径长度较短的文件似乎可以正常工作。

0 个答案:

没有答案