[PyQt] Debugging Qt error messages
Giovanni Bajo
rasky at develer.com
Thu Jul 12 18:22:25 BST 2007
Hello,
when Qt outputs an error message using qDebug() / qFatal() / qWarning()
/ qCritical(), it's hard to trace the message back to Python code.
With C++ code, you simply put a breakpoint on the message and look at
the stack trace in the debugger. There are also helpers like
QT_FATAL_WARNINGS. But the C/C++ backtrace doesn't immediatly point to
Python code.
I tried installing a custom message handler using qInstallMsgHandler(),
like this:
def myMsgHandler(msg_type, txt):
raise RuntimeError(txt)
but the problem is that the exceptions is intercepted and shut down
immediatly; it doesn't propagate back to the original Python code. The
traceback is thus useless: it just contains this function.
Any suggestions about solving this problem? Maybe a modification /
special handling in PyQt is required?
--
Giovanni Bajo
More information about the PyQt
mailing list