[Tutor] No module named 'module name'

Robert Berman bermanrl at cfl.rr.com
Sun Jan 25 18:22:43 CET 2009

In the following code:

import sys

from PyQt4 import QtCore, QtGui

from testwin import Ui_TestWindow

class StartQT4(QtGui.QMainWindow):
    def __init__(self, parent = None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_TestWindow()
if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = StartQT4()

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 although I hate to 
even bring that up as I am using Linux Ubuntu 8.10 and cannot remember a 
"path" error since working under Windows XP.

The editor in use is Wing IDE Personal version. I am building my form(s) 
using QT4 and testwin.py is built with pyuic4.

I have sen some reference to something called "Python Path", but it 
seems to be referenced most often by Windows users so I am now totally 
confused. Would a few of you who understand these relationships far 
better than I please elaborate as to what I might be doing wrong.

Thanks for the assistance.

Robert Berman

More information about the Tutor mailing list