Search path on Windows

michael benjamin mayhew mayhew at cis.ohio-state.edu
Mon Aug 19 21:38:37 EDT 2002


Hi,

    You need to append the name of the directory in which your module
resides as a string object to the list sys.path. In other words:

    import sys

    sys.path.append('the directory of your module')

  Hope this helps.

Michael Mayhew

Jason Taylor wrote:

> This is a newbie question.
>
> How do you tell the pyhton interpreter where to find modules that you
> want to import?
>
> Say, I have a file mymodule1.py in directory C:\home\MyPythonCode
>
> In another file, I have the statement:
>
> from mymodule1 import *
>
> How do I configure Python 2.2 for Windows, so that it will know where
> to find mymodule1.py?
>
> Does it matter that I am running the scripts from emacs?
>
> I have the book "Programming Python" by Mark Lutz but I can't seem to
> find the information I need.
>
> Thanks,
> Jason




More information about the Python-list mailing list