Markdown Format | JSON API | MCP Server Tool
Help on module zipimport: NAME zipimport - zipimport provides support for importing Python modules from Zip archives. 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: - zipimporter: a class; its constructor takes a path to a Zip archive. - ZipImportError: exception raised by zipimporter objects. It's a subclass of ImportError, so it can be caught as ImportError, too. - _zip_directory_cache: a dict, mapping archive paths to zip directory info dicts, as used in zipimporter._files. 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) | Method resolution order: | ZipImportError | builtins.ImportError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.ImportError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.ImportError: | | msg | exception message | | name | module name | | path | module path | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args 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. | | Method resolution order: | zipimporter | _frozen_importlib_external._LoaderBasics | builtins.object | | Methods defined here: | | __init__(self, path) | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | find_loader(self, fullname, path=None) | find_loader(fullname, path=None) -> self, str or None. | | Search for a module specified by 'fullname'. 'fullname' must be the | fully qualified (dotted) module name. It returns the zipimporter | instance itself if the module was found, a string containing the | full path name if it's possibly a portion of a namespace package, | or None otherwise. The optional 'path' argument is ignored -- it's | there for compatibility with the importer protocol. | | Deprecated since Python 3.10. Use find_spec() instead. | | find_module(self, fullname, path=None) | find_module(fullname, path=None) -> self or None. | | Search for a module specified by 'fullname'. 'fullname' must be the | fully qualified (dotted) module name. It returns the zipimporter | instance itself if the module was found, or None if it wasn't. | The optional 'path' argument is ignored -- it's there for compatibility | with the importer protocol. | | Deprecated since Python 3.10. Use find_spec() instead. | | find_spec(self, fullname, target=None) | Create a ModuleSpec for the specified module. | | Returns None if the module cannot be found. | | get_code(self, fullname) | get_code(fullname) -> code object. | | Return the code object for the specified module. Raise ZipImportError | if the module couldn't be imported. | | get_data(self, pathname) | get_data(pathname) -> string with file data. | | Return the data associated with 'pathname'. Raise OSError if | the file wasn't found. | | get_filename(self, fullname) | get_filename(fullname) -> filename string. | | Return the filename for the specified module or raise ZipImportError | if it couldn't be imported. | | get_resource_reader(self, fullname) | Return the ResourceReader for a package in a zip file. | | If 'fullname' is a package within the zip file, return the | 'ResourceReader' object for the package. Otherwise return None. | | get_source(self, fullname) | get_source(fullname) -> source string. | | Return the source code for the specified module. Raise ZipImportError | if the module couldn't be found, return None if the archive does | contain the module, but has no source for it. | | invalidate_caches(self) | Reload the file data of the archive path. | | is_package(self, fullname) | is_package(fullname) -> bool. | | Return True if the module specified by fullname is a package. | Raise ZipImportError if the module couldn't be found. | | load_module(self, fullname) | load_module(fullname) -> module. | | Load the module specified by 'fullname'. 'fullname' must be the | fully qualified (dotted) module name. It returns the imported | module, or raises ZipImportError if it could not be imported. | | Deprecated since Python 3.10. Use exec_module() instead. | | ---------------------------------------------------------------------- | Methods inherited from _frozen_importlib_external._LoaderBasics: | | create_module(self, spec) | Use default semantics for module creation. | | exec_module(self, module) | Execute the module. | | ---------------------------------------------------------------------- | Data descriptors inherited from _frozen_importlib_external._LoaderBasics: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) DATA __all__ = ['ZipImportError', 'zipimporter'] FILE (built-in)
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:14 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)