Newbie question ... reading modules from directories in Windows

David Bolen db3l at fitlinxx.com
Tue Jan 2 18:05:05 EST 2001


"Peder Jakobsen" <jakobsen at home.com> writes:

> Just a small question:
> 
> I have added a "C:\Python20\sandbox" directory to my PYTHONPATH
> 
> Now I'm trying to import modules from that directory whole using the
> interactive Python prompt, but it only works if I start python.exe in the
> directory where the module resides.

It should work fine with the PYTHONPATH setting, but are you positive
that you modified the environment variable in the same session that
you are running python.exe in?

As a simple test, start a command prompt, issue the "SET
PYTHONPATH=xxx" command manually and then run python.  It should work.

Another way to check is that after starting Python interactively,
import sys and then print sys.path - it should include your directory.
You can also import os and use "os.environ['PYTHONPATH']" to see the
exact environment variable that is active in your current session.

Depending on your Windows variant and how you make the change, you may
need to ensure that your python session is started after you make the
change, or you may need to ensure you "apply" the change from the
environment window - I'm not sure if Win95 might need a reboot or not.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list