[Tutor] Problem Importing Classes I Create in WinNT
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Sat, 7 Jul 2001 20:48:13 -0700 (PDT)
On Sat, 7 Jul 2001, Britt Green wrote:
> I've created a very minimal class in Python. I save it and then try to
> import it into another program like so:
>
> import GameTime
>
> myTime = GameTime(100)
>
> Unfortunately the Python shells spits this back at me:
>
> Traceback (innermost last):
> File "C:/Python20/Code/stub.py", line 1, in ?
> import GameTime
> ImportError: No module named GameTime
>
> I've checked and the folder that both of these files are in is in my system
> PATH variable. Any thoughts?
Do you mean the system PATH, or the system PYTHONPATH? The difference
between them is that PATH is used for running executables (throughout the
system, not just Python), and PYTHONPATH is used for looking up Python
modules.
You might need to add an entry in your PYTHONPATH to include those
directories. Good luck!