Issue
I wanted to spawn a QWebKit instance in PySide and quickly got a segmentation fault - I forgot to set up an instance of QApplication. Since SIGSEGV is not a good failure mode, is there a way to catch that and throw an exception instead?
Solution
The QCoreApplication
class (which QApplication
inherits), has the static method instance() which allows you to check this:
if QApplication.instance() is not None:
# do stuff..
else:
raise RuntimeError('no application object')
Answered By - ekhumoro
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.