Module zipimport :: Class zipimporter
[hide private]
[frames] | no frames]

Class zipimporter

object --+
         |
        zipimporter

zipimporter(archivepath) -> zipimporter object

Create a new zipimporter instance. 'archivepath' must be a path to a zipfile. ZipImportError is raised if 'archivepath' doesn't point to a valid Zip archive.

Instance Methods [hide private]
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
zipimporter object
__init__(archivepath)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__repr__(x)
repr(x)
self or None
find_module(fullname, path=None)
Search for a module specified by 'fullname'.
code object
get_code(fullname)
Return the code object for the specified module.
string with file data
get_data(pathname)
Return the data associated with 'pathname'.
source string
get_source(fullname)
Return the source code for the specified module.
bool
is_package(fullname)
Return True if the module specified by fullname is a package.
module
load_module(fullname)
Load the module specified by 'fullname'.

Inherited from object: __delattr__, __hash__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]
  _files
  archive
  prefix

Inherited from object: __class__

Method Details [hide private]

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: object.__getattribute__

__init__(archivepath)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Returns: zipimporter object
Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

find_module(fullname, path=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.

Returns: self or None

get_code(fullname)

 

Return the code object for the specified module. Raise ZipImportError is the module couldn't be found.

Returns: code object

get_data(pathname)

 

Return the data associated with 'pathname'. Raise IOError if the file wasn't found.

Returns: string with file data

get_source(fullname)

 

Return the source code for the specified module. Raise ZipImportError is the module couldn't be found, return None if the archive does contain the module, but has no source for it.

Returns: source string

is_package(fullname)

 

Return True if the module specified by fullname is a package. Raise ZipImportError is the module couldn't be found.

Returns: bool

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 ZipImportError if it wasn't found.

Returns: module