Module Import Path?
Brian van den Broek
bvande at po-box.mcgill.ca
Sat Jul 31 19:10:26 CEST 2004
Jesse B. said unto the world upon 31/07/2004 15:42:
> I have just begun to learn python using o'reilly's Learning Python, and in
> chapter 3 it talks about importing modules. It has me make modules to
> practice using the 'import' and 'from' statements from the python command
> I don't know what directory to save these files in because I'm not sure what
> directories 'import' is looking in to find modules. I've done some google
> searches trying to find out where the 'import' search path is, but I'm not
> familiar enough with python to do a clear enough search. I'd appriciate it
> if anyone can help me out or point me in the right direction.
Typing too quickly, I wrote
> import sys
> will tell you how your Python Path is configured.
Not everything returned by sys.path is there because of your PYTHONPATH
environment variable. For instance, the first entry is the one from which
your running script was loaded. Likewise, the standard Library Dirs are
there, too. Check out the sys module documentation for the full details.
More information about the Python-list