summaryrefslogtreecommitdiffstats
path: root/Doc/library/zipimport.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-11 15:05:13 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-11 15:05:13 (GMT)
commit6a57c08dc828ff8512c047c97e7c7edfb0abbc74 (patch)
tree74e089debd39df01c79b57352dee0a05b57dae50 /Doc/library/zipimport.rst
parentae98f50eca5c5fbae6ae9ba390c5ed8729489b00 (diff)
downloadcpython-6a57c08dc828ff8512c047c97e7c7edfb0abbc74.zip
cpython-6a57c08dc828ff8512c047c97e7c7edfb0abbc74.tar.gz
cpython-6a57c08dc828ff8512c047c97e7c7edfb0abbc74.tar.bz2
#1326: document and test zipimporter.archive and zipimporter.prefix.
Diffstat (limited to 'Doc/library/zipimport.rst')
-rw-r--r--Doc/library/zipimport.rst25
1 files changed, 14 insertions, 11 deletions
diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst
index 0e8770c..104182e 100644
--- a/Doc/library/zipimport.rst
+++ b/Doc/library/zipimport.rst
@@ -65,17 +65,14 @@ zipimporter Objects
.. class:: zipimporter(archivepath)
- Create a new zipimporter instance. *archivepath* must be a path to a ZIP file.
+ Create a new zipimporter instance. *archivepath* must be a path to a ZIP
+ file, or to a specific path within a ZIP file. For example, an *archivepath*
+ of :file:`foo/bar.zip/lib` will look for modules in the :file:`lib` directory
+ inside the ZIP file :file:`foo/bar.zip` (provided that it exists).
+
:exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid ZIP
archive.
- *archivepath* can also contain a path within the ZIP file -- the importer
- object will then look under that path instead of the ZIP file root. For
- example, an *archivepath* of :file:`foo/bar.zip/lib` will look for modules
- in the :file:`lib` directory inside the ZIP file :file:`foo/bar.zip`
- (provided that it exists).
-
-
.. method:: find_module(fullname[, path])
Search for a module specified by *fullname*. *fullname* must be the fully
@@ -120,13 +117,19 @@ zipimporter Objects
.. attribute:: archive
- The file name of the importer's associated ZIP file.
+ The file name of the importer's associated ZIP file, without a possible
+ subpath.
.. attribute:: prefix
- The path within the ZIP file where modules are searched; see
- :class:`zipimporter` for details.
+ The subpath within the ZIP file where modules are searched. This is the
+ empty string for zipimporter objects which point to the root of the ZIP
+ file.
+
+ The :attr:`archive` and :attr:`prefix` attributes, when combined with a
+ slash, equal the original *archivepath* argument given to the
+ :class:`zipimporter` constructor.
.. _zipimport-examples: