class zipimport.zipimporter(archivepath)
Create a new zipimporter instance. archivepath must be a path to a ZIP file, or to a specific path within a ZIP file. For example, an archivepath of foo/bar.zip/lib will look for modules in the lib directory inside the ZIP file foo/bar.zip (provided that it exists).
ZipImportError is raised if archivepath doesn’t point to a valid ZIP archive.
-
find_module(fullname[, path]) -
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
Noneif it wasn’t. The optional path argument is ignored—it’s there for compatibility with the importer protocol.
-
get_code(fullname) -
Return the code object for the specified module. Raise
ZipImportErrorif the module couldn’t be found.
-
get_data(pathname) -
Return the data associated with pathname. Raise
OSErrorif the file wasn’t found.
-
get_filename(fullname) -
Return the value
__file__would be set to if the specified module was imported. RaiseZipImportErrorif the module couldn’t be found.New in version 3.1.
-
get_source(fullname) -
Return the source code for the specified module. Raise
ZipImportErrorif the module couldn’t be found, returnNoneif the archive does contain the module, but has no source for it.
-
is_package(fullname) -
Return
Trueif the module specified by fullname is a package. RaiseZipImportErrorif the module couldn’t be found.
-
load_module(fullname) -
Load the module specified by fullname. fullname must be the fully qualified (dotted) module name. It returns the imported module, or raises
ZipImportErrorif it wasn’t found.
-
archive -
The file name of the importer’s associated ZIP file, without a possible subpath.
-
prefix -
The subpath within the ZIP file where modules are searched. This is the empty string for zipimporter objects which point to the root of the ZIP file.
The archive and prefix attributes, when combined with a slash, equal the original archivepath argument given to the zipimporter constructor.
Please login to continue.