[PyQt] Bug: PyQt causes Python to abnormally exit upon creating QWidget without a QApplication

Shriramana Sharma samjnaa at gmail.com
Thu Apr 9 09:15:47 BST 2009


Hello. See the following:

$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from PyQt4.QtGui import *
 >>> w = QWidget ()
QWidget: Must construct a QApplication before a QPaintDevice
$

I think this should be handled more gracefully with a Python exception 
(or error, if the two are not the same) thrown rather than Python 
abnormally exiting, like follows:

$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> a="b"
 >>> c=2
 >>> a+b
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
NameError: name 'b' is not defined
 >>>



More information about the PyQt mailing list