def _find_module(name, path=None):
try:
return imp._find_module(name, path)
except ImportError:
if _zip_file is None:
raise ImportError
z = zipimporter(_zip_file)
try:
code = z.get_code(name)
except ZipImportError:
raise ImportError('Failed to find module: %s' % name)
mod = _make_pyc(code)
mod_names = [_zip_file] + name.split('.')
mod_names[-1] += '.pyc'
pathname = os.path.join(*mod_names)
description = ('.pyc', 'rb', imp.PY_COMPILED)
return (mod, pathname, description)
zip_imp.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录