ImportError: No module named ui_imagedialog
Question: I am new to pyQt4. First I installed pyqt4 then installed QTDesigner. And
tried to run the given program( From internet). The file is named as main.py

    
    
    import sys
    from PyQt4.QtGui import QApplication, QDialog
    from ui_imagedialog import Ui_ImageDialog
    app = QApplication(sys.argv)
    window = QDialog()
    ui = Ui_ImageDialog()
    ui.setupUi(window)
    window.show()
    sys.exit(app.exec_())  
    

run the program using terminal

    
    
    python main.py
    

I got the following error

    
    
    from ui_imagedialog import Ui_ImageDialog
    ImportError: No module named ui_imagedialog
    

How to solve this??


Answer: You could try running this instead;

    
    
    import sys
    from PyQt4.QtGui import QApplication, QDialog
    app = QApplication(sys.argv)
    window = QDialog()
    
    window.show()
    sys.exit(app.exec_()) 
    

And if you are using PyQt5, use this;

    
    
    import sys
    from PyQt5.QtWidgets import QApplication, QDialog
    
    app = QApplication(sys.argv)
    window = QDialog()
    
    window.show()
    sys.exit(app.exec_())
    

This will produce an empty window. From the
[documentation](http://pyqt.sourceforge.net/Docs/PyQt5/designer.html), the
**ui_imagedialog** is an imaginary file.

