[英]python.exe crashed when open long path in windows 7
Python crashed when I did following steps: 当我执行以下步骤时,Python崩溃了:
os.makedirs(ur'\\?\c:\测试文件夹')
open(ur'\\?\c:\测试文件夹\t.txt','w')
You can see full path here: http://psf.upfronthosting.co.za/roundup/meta/issue629%3E 你可以在这里看到完整的路径: http : //psf.upfronthosting.co.za/roundup/meta/issue629%3E
Windows has a path length limit (which includes everything after the drive letter) of 256 characters; Windows的路径长度限制(包括驱动器号后面的所有内容)为256个字符; the issue appears to be that your path exceeds that limit.
问题似乎是你的路径超过了这个限制。 If you try to create that path manually via Windows Explorer, I think you'll find the path cannot be created there as well.
如果您尝试通过Windows资源管理器手动创建该路径,我想您也会发现无法在那里创建路径。
From MSDN docs ( link ): 来自MSDN文档( 链接 ):
In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters.
在Windows API中(以下段落中讨论了一些例外),路径的最大长度为MAX_PATH,定义为260个字符。 A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character.
本地路径按以下顺序构成:驱动器号,冒号,反斜杠,由反斜杠分隔的名称组件以及终止空字符。 For example, the maximum path on drive D is "D:\\some 256-character path string" where "" represents the invisible terminating null character for the current system codepage.
例如,驱动器D上的最大路径是“D:\\某个256个字符的路径字符串”,其中“”表示当前系统代码页的不可见的终止空字符。 (The characters < > are used here for visual clarity and cannot be part of a valid path string.)
(这里使用字符<>是为了清晰,不能成为有效路径字符串的一部分。)
thanks for all. 谢谢大家。 it's maybe macfee injected into the python.exe process.
它可能是macfee注入python.exe进程。 see: https://bugs.python.org/issue30494
请参阅: https : //bugs.python.org/issue30494
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.