February 2006
Intermediate to advanced
648 pages
14h 53m
English
When loading modules, the interpreter searches the list of directories in sys.path. The following is a typical value of sys.path:
['', '/usr/local/lib/python2.0',
'/usr/local/lib/python2.0/plat-sunos5',
'/usr/local/lib/python2.0/lib-tk',
'/usr/local/lib/python2.0/lib-dynload',
'/usr/local/lib/python2.0/site-packages']The empty string '’ refers to the current directory.
To add new directories to the search path, simply append them to this list.
In addition to directories, ZIP archive files containing Python modules can be added to the search path. This can be a convenient way to package a collection of modules as a single file. For example, suppose you created two modules, foo.py and bar.py, and placed them in a zip file ...