pydoc > zipimport

📛 NAME

zipimport - zipimport provides support for importing Python modules from Zip archives.

🚀 Quick Reference

Use CaseCommandDescription
Create importerzipimporter("/path/to/archive.zip")Make a zipimporter for a Zip file or internal path
Find module specimporter.find_spec("mymodule")Get a ModuleSpec for the module (modern API)
Get code objectimporter.get_code("mymodule")Return compiled code object for the module
Get source codeimporter.get_source("mymodule")Return source string; None if no source in archive
Load moduleimporter.load_module("mymodule")Load and return module (deprecated, use exec_module)
Check if packageimporter.is_package("mypackage")Return True if it's a package
Get file dataimporter.get_data("path/inside.zip")Return raw bytes of a file inside the archive
Invalidate cacheimporter.invalidate_caches()Reload zip directory info (e.g. after archive changes)
Resource readerimporter.get_resource_reader("mypackage")Get a ResourceReader for package inside a zip
Handle errorstry: ... except ZipImportError: ...ZipImportError is a subclass of ImportError

📚 MODULE REFERENCE

https://docs.python.org/3.10/library/zipimport.html

The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.

📖 DESCRIPTION

This module exports three objects:

It is usually not needed to use the zipimport module explicitly; it is used by the builtin import mechanism for sys.path items that are paths to Zip archives.

🧩 CLASSES

_frozen_importlib_external._LoaderBasics(builtins.object)
    zipimporter
builtins.ImportError(builtins.Exception)
    ZipImportError

🚫 class ZipImportError(builtins.ImportError)

📦 class zipimporter(_frozen_importlib_external._LoaderBasics)

zipimporter(path)

zipimporter(archivepath) -> zipimporter object

Create a new zipimporter instance. 'archivepath' must be a path to a zipfile, or to a specific path inside a zipfile. For example, it can be '/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a valid directory inside the archive.

ZipImportError is raised if archivepath doesn't point to a valid Zip archive.

The archive attribute of zipimporter objects contains the name of the zipfile targeted.

📋 DATA

__all__ = ['ZipImportError', 'zipimporter']

📁 FILE

(built-in)

zipimport
📛 NAME 🚀 Quick Reference 📚 MODULE REFERENCE 📖 DESCRIPTION 🧩 CLASSES
🚫 class ZipImportError(builtins.ImportError) 📦 class zipimporter(_frozen_importlib_external._LoaderBasics)
📋 DATA 📁 FILE

Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 18:14 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^