| | |
- exceptions.Exception
-
- BadZipfile
- BadZipfile
- ZipFile
-
- PyZipFile
- ZipInfo
class PyZipFile(ZipFile) |
| |
Class to create ZIP archives with Python library files and packages. |
| |
- _GetContents(self) from ZipFile
- _RealGetContents(self) from ZipFile
- __del__(self) from ZipFile
- __init__(self, file, mode='r', compression=0) from ZipFile
- _get_codename(self, pathname, basename)
- Return (filename, archivename) for the path.
Given a module name path, return the correct file path and
archive name, compiling if necessary. For example, given
/python/lib/string, return (/python/lib/string.pyc, string).
- _writecheck(self, zinfo) from ZipFile
- close(self) from ZipFile
- getinfo(self, name) from ZipFile
- infolist(self) from ZipFile
- namelist(self) from ZipFile
- printdir(self) from ZipFile
- read(self, name) from ZipFile
- testzip(self) from ZipFile
- write(self, filename, arcname=None, compress_type=None) from ZipFile
- 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.
- writestr(self, zinfo, bytes) from ZipFile
|
class ZipFile |
| |
Class with methods to open, read, write, close, list zip files.
z = ZipFile(file, mode="r", compression=ZIP_STORED)
/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). |
| |
- _GetContents(self)
- Read the directory, making sure we close the file if the format
is bad.
- _RealGetContents(self)
- Read in the table of contents for the ZIP file.
- __del__(self)
- Call the "close()" method in case the user forgot.
- __init__(self, file, mode='r', compression=0)
- Open the ZIP file with mode read "r", write "w" or append "a".
- _writecheck(self, zinfo)
- Check for errors before writing a file to the archive.
- 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, bytes)
- Write a file into the archive. The contents is the string
'bytes'.
|
class ZipInfo |
| |
Class with attributes describing each file in the ZIP archive. |
| |
- FileHeader(self)
- Return the per-file header as a string.
- __init__(self, filename='NoName', date_time=(1980, 1, 1, 0, 0, 0))
|
|