[Tutor] No module named 'module name'

Alan Gauld alan.gauld at btinternet.com
Sun Jan 25 19:04:00 CET 2009

"Robert Berman" <bermanrl at cfl.rr.com> wrote
> from testwin import Ui_TestWindow
> I receive the following error message: Import error: No module named 
> testwin.

> If I use ipython and do the from statement, it works just fine. I 
> think it may have something to do with a path value

I think you are right!

Try putting

import sys
print sys.path

At the top of the file then run it from both IPython and Wing.

Also try running the file from an OS prompt rather than
from inside the IDE.

> I have seen some reference to something called "Python Path", but it 
> seems to be referenced most often by Windows users

Nope, PYTHONPATH applies to any OS.
You need to use it if you have any modules in folders other than
the default locations used by Python. I think the preferred place
to set PYTHONPATH is in your .login script but if I'm wrong I'm
sure a more regular *nix user will say so :-)


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list