PyDocs

Nav

Importing Modules

zipimporter

  • zipimporter(archivepath)
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.
Changed in 3.12
  • 3.12: Methods find_loader() and find_module(), deprecated in 3.10 are now removed. Use find_spec() instead.
Members of zipimporter

a

archive
The file name of the importer’s associated ZIP file, without a possible subpath.

c

create_module
Use default semantics for module creation.

e

exec_module
Execute the module.

f

find_spec
Create a ModuleSpec for the specified module.

g

get_code
Return the code object for the specified module.
get_data
Return the data associated with 'pathname'.
get_filename
Return the filename for the specified module or raise ZipImportError if it couldn't be found.
get_source
Return the source code for the specified module.

i

invalidate_caches
Invalidates the cache of file data of the archive path.
is_package
Return True if the module specified by fullname is a package.

p

prefix
The subpath within the ZIP file where modules are searched.
0 Examples
No examples for zipimport/zipimporter.
See Also
No see-alsos for zipimport/zipimporter
0 Notes
No notes for zipimporter