zipfile
index
/usr/local/lib/python2.5/zipfile.py
Module Docs

Read and write ZIP files.

 
Modules
       
binascii
cStringIO
os
struct
sys
time
zlib

 
Classes
       
__builtin__.object
ZipInfo
exceptions.Exception(exceptions.BaseException)
BadZipfile
BadZipfile
LargeZipFile
ZipFile
PyZipFile

 
class BadZipfile(exceptions.Exception)
    
Method resolution order:
BadZipfile
exceptions.Exception
exceptions.BaseException
__builtin__.object

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

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8125440>
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)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class LargeZipFile(exceptions.Exception)
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
and those extensions are disabled.
 
 
Method resolution order:
LargeZipFile
exceptions.Exception
exceptions.BaseException
__builtin__.object

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

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8125440>
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)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
class PyZipFile(ZipFile)
    Class to create ZIP archives with Python library files and packages.
 
  Methods defined here:
writepy(self, pathname, basename='')
Add all files from "pathname" to the ZIP archive.
 
If pathname is a package directory, search the directory and
all package subdirectories recursively for all *.py and enter
the modules into the archive.  If pathname is a plain
directory, listdir *.py and enter all modules.  Else, pathname
must be a Python *.py file and the module will be put into the
archive.  Added modules are always module.pyo or module.pyc.
This method will compile the module.py into module.pyc if
necessary.

Methods inherited from ZipFile:
__del__(self)
Call the "close()" method in case the user forgot.
__init__(self, file, mode='r', compression=0, allowZip64=False)
Open the ZIP file with mode read "r", write "w" or append "a".
close(self)
Close the file, and for mode "w" and "a" write the ending
records.
getinfo(self, name)
Return the instance of ZipInfo given 'name'.
infolist(self)
Return a list of class ZipInfo instances for files in the
archive.
namelist(self)
Return a list of file names in the archive.
printdir(self)
Print a table of contents for the zip file.
read(self, name)
Return file bytes (as a string) for name.
testzip(self)
Read all the files and check the CRC.
write(self, filename, arcname=None, compress_type=None)
Put the bytes from filename into the archive under the name
arcname.
writestr(self, zinfo_or_arcname, bytes)
Write a file into the archive.  The contents is the string
'bytes'.  'zinfo_or_arcname' is either a ZipInfo instance or
the name of the file in the archive.

Data and other attributes inherited from ZipFile:
fp = None

 
class ZipFile
    Class with methods to open, read, write, close, list zip files.
 
z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True)
 
/get.cgi/ Either the path to the file, or a file-like object.
      If it is a path, the file will be opened and closed by ZipFile.
mode: The mode can be either read "r", write "w" or append "a".
compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib).
allowZip64: if True ZipFile will create files with ZIP64 extensions when
            needed, otherwise it will raise an exception when this would
            be necessary.
 
  Methods defined here:
__del__(self)
Call the "close()" method in case the user forgot.
__init__(self, file, mode='r', compression=0, allowZip64=False)
Open the ZIP file with mode read "r", write "w" or append "a".
close(self)
Close the file, and for mode "w" and "a" write the ending
records.
getinfo(self, name)
Return the instance of ZipInfo given 'name'.
infolist(self)
Return a list of class ZipInfo instances for files in the
archive.
namelist(self)
Return a list of file names in the archive.
printdir(self)
Print a table of contents for the zip file.
read(self, name)
Return file bytes (as a string) for name.
testzip(self)
Read all the files and check the CRC.
write(self, filename, arcname=None, compress_type=None)
Put the bytes from filename into the archive under the name
arcname.
writestr(self, zinfo_or_arcname, bytes)
Write a file into the archive.  The contents is the string
'bytes'.  'zinfo_or_arcname' is either a ZipInfo instance or
the name of the file in the archive.

Data and other attributes defined here:
fp = None

 
class ZipInfo(__builtin__.object)
    Class with attributes describing each file in the ZIP archive.
 
  Methods defined here:
FileHeader(self)
Return the per-file header as a string.
__init__(self, filename='NoName', date_time=(1980, 1, 1, 0, 0, 0))

Data descriptors defined here:
CRC
comment
compress_size
compress_type
create_system
create_version
date_time
external_attr
extra
extract_version
file_size
filename
flag_bits
header_offset
internal_attr
orig_filename
reserved
volume

 
error = class BadZipfile(exceptions.Exception)
    
Method resolution order:
BadZipfile
exceptions.Exception
exceptions.BaseException
__builtin__.object

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

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object at 0x8125440>
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)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message
exception message

 
Functions
       
is_zipfile(filename)
Quickly see if file is a ZIP file by checking the magic number.

 
Data
        ZIP_DEFLATED = 8
ZIP_STORED = 0
__all__ = ['BadZipfile', 'error', 'ZIP_STORED', 'ZIP_DEFLATED', 'is_zipfile', 'ZipInfo', 'ZipFile', 'PyZipFile', 'LargeZipFile']