GNU Info

Info Node: (python2.1-lib.info)PyZipFile Objects

(python2.1-lib.info)PyZipFile Objects


Next: ZipInfo Objects Prev: ZipFile Objects Up: zipfile
Enter node , (file) or (file)node

PyZipFile Objects
-----------------

The `PyZipFile' constructor takes the same parameters as the `ZipFile'
constructor.  Instances have one method in addition to those of
`ZipFile' objects.

`writepy(pathname[, basename])'
     Search for files `*.py' and add the corresponding file to the
     archive.  The corresponding file is a `*.pyo' file if available,
     else a `*.pyc' file, compiling if necessary.  If the pathname is a
     file, the filename must end with `.py', and just the
     (corresponding `*.py[co]') file is added at the top level (no path
     information).  If it is a directory, and the directory is not a
     package directory, then all the files `*.py[co]' are added at the
     top level.  If the directory is a package directory, then all
     `*.py[oc]' are added under the package name as a file path, and if
     any subdirectories are package directories, all of these are added
     recursively.  BASENAME is intended for internal use only.  The
     `writepy()' method makes archives with file names like this:

              string.pyc                                # Top level name
              test/__init__.pyc                         # Package directory
              test/testall.pyc                          # Module test.testall
              test/bogus/__init__.pyc                   # Subpackage directory
              test/bogus/myfile.pyc                     # Submodule test.bogus.myfile


automatically generated by info2www version 1.2.2.9