zipimport.ZipImportError: bad local file header caused by zip caching bug?
zipimport.ZipImportError: bad local file header caused by zip caching bug?
我正在尝试确定 python 使用的 zip 缓存机制是否仍然存在错误。原因是因为我的 运行ning python 代码将(看似)随机失败 zipimport.ZipImportError: bad local file header
.
它可能 运行 一切正常,然后突然间,ZipImportError
当它试图导入我安装的自定义模块时(当它已经 运行 在执行的早期使用相同的代码)。当应用程序 运行ning 时,我没有更改自定义模块的 egg 文件,所以我有点难过。
使用谷歌搜索有关此错误的帮助 an old mailing list thread 指出
This might be due to:
http://bugs.python.org/issue856103
Specifically, zipimport's caching doesn't notice that it's not
working on the same zipfile any more. easy_install is supposed to
have some code in it to clear out the zipimport cache, but there is
some possibility that it could have two versions of the path in there
on a case-insensitive filesystem (e.g. Windows), and only one of them
is getting cleared. Dunno if that's the case or not, but it might be
something to look into. You could always stick a debugging print in
the uncache_zipdir function and see if there's any correlation
between what it's doing and when you're getting the error.
我不清楚链接错误的解决方案。
我认为此时解决我的问题的唯一方法是将我的自定义模块标记为 zip_safe=false
。除非有某种方法可以禁用 zip 缓存或类似的东西?
我从未找到此问题的原因或解决方法,但我更改了我的模块以使用 zip_safe=false
,这防止了问题再次发生。就我而言,这已经足够了。
我正在尝试确定 python 使用的 zip 缓存机制是否仍然存在错误。原因是因为我的 运行ning python 代码将(看似)随机失败 zipimport.ZipImportError: bad local file header
.
它可能 运行 一切正常,然后突然间,ZipImportError
当它试图导入我安装的自定义模块时(当它已经 运行 在执行的早期使用相同的代码)。当应用程序 运行ning 时,我没有更改自定义模块的 egg 文件,所以我有点难过。
使用谷歌搜索有关此错误的帮助 an old mailing list thread 指出
This might be due to:
http://bugs.python.org/issue856103
Specifically, zipimport's caching doesn't notice that it's not working on the same zipfile any more. easy_install is supposed to have some code in it to clear out the zipimport cache, but there is some possibility that it could have two versions of the path in there on a case-insensitive filesystem (e.g. Windows), and only one of them is getting cleared. Dunno if that's the case or not, but it might be something to look into. You could always stick a debugging print in the uncache_zipdir function and see if there's any correlation between what it's doing and when you're getting the error.
我不清楚链接错误的解决方案。
我认为此时解决我的问题的唯一方法是将我的自定义模块标记为 zip_safe=false
。除非有某种方法可以禁用 zip 缓存或类似的东西?
我从未找到此问题的原因或解决方法,但我更改了我的模块以使用 zip_safe=false
,这防止了问题再次发生。就我而言,这已经足够了。