[Tutor] Making Python Find Modules

Michael P. Reilly arcege@shore.net
Sun, 18 Mar 2001 06:58:43 -0500 (EST)


> I know that the answer to this question must be painfully obvious, but I 
> can't seem to find it anywhere. If I have a folder called Code in my Python 
> directory, how can I make Python see the modules that are in there? This is 
> on a WinNT box.

There are two ways, inside python or within the environment.

1.  Add the directory to the path:
>>> import sys
>>> sys.path.insert(0, r'c:\python20\Code')

2.  Create a new environment variable: open the system properties and
add 'PYTHONPATH' with your directory to the user environment section.
If a path already exists, append the directory with a semicolon (;).

  -Arcege

-- 
------------------------------------------------------------------------
| Michael P. Reilly, Release Manager  | Email: arcege@shore.net        |
| Salem, Mass. USA  01970             |                                |
------------------------------------------------------------------------