zipimport
index
(built-in)
Module Docs

zipimport provides support for importing Python modules from Zip archives.
 
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
       
__builtin__.object
zipimporter
exceptions.ImportError(exceptions.StandardError)
ZipImportError

 
class ZipImportError(exceptions.ImportError)
    
Method resolution order:
ZipImportError
exceptions.ImportError
exceptions.StandardError
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.ImportError:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.ImportError:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class zipimporter(__builtin__.object)
    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.
 
  Methods defined here:
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
find_module(...)
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.
get_code(...)
get_code(fullname) -> code object.
 
Return the code object for the specified module. Raise ZipImportError
if the module couldn't be found.
get_data(...)
get_data(pathname) -> string with file data.
 
Return the data associated with 'pathname'. Raise IOError if
the file wasn't found.
get_filename(...)
get_filename(fullname) -> filename string.
 
Return the filename for the specified module.
get_source(...)
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.
is_package(...)
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(...)
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 wasn't found.

Data descriptors defined here:
archive
prefix

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T