6.4. Importing Modules
Python does a lot of work to guess where to look for the modules it needs to import. You can see the fruit of its labors by looking at the path variable of the sys module. Each directory listed in this path will be searched for modules when an import statement is executed. You can add directories to this list if you need to by means of an environment variable called PYTHONPATH.
Here is my path on Windows NT:
CD-ROM reference=6021.txt >>> import sys >>> print sys.path ['', 'c:\\', C:\\PROGRA~1\\PYTHON', 'C:\\Program Files\\Python\\Lib\\plat-win', 'C:\\Program Files\\Python\\Lib', 'C:\\Program Files\\Python\\DLLs', 'C:\\Program Files\\Python\\Lib\\lib-tk', 'c:\\program files\\python\\DLLs', 'c:\\program files\\python\\lib', ...
Get XML Processing with Python now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.