Module Import Path?

Brian van den Broek bvande at
Sat Jul 31 19:05:28 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
> line.
> 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.


import sys

will tell you how your Python Path is configured.

On windows, you can configure your Python path by including a line like:


in your Autoexec.bat file. Just be sure not to put any spaces around the 
'=' and to separate multiple directories with ';' characters.

Some windows versions (not mine, so I cannot say exactly what to do) allow 
you to set the PythonPath environment variable via the Control Panel.


Brian vdB

More information about the Python-list mailing list