Howdy! I had a major problem with this myself and after doing some research I finally found a solution in eventFilters (<a href="http://doc.trolltech.com/4.3/qobject.html#eventFilter">http://doc.trolltech.com/4.3/qobject.html#eventFilter
</a>) which is basically the same thing only you don't need to mess with class wrappers and stuff =]<br> <br>Here is my example that I used. Pretty simple, and you'll need to adjust it for your specific problem and you'll need to look at (
<a href="http://doc.trolltech.com/4.3/qevent.html">http://doc.trolltech.com/4.3/qevent.html</a>) for all the event code. It just gave me a traceback at the point I verified it errored, in this case when I clicked the object.
<br><br>class FilterObject(QtCore.QObject):<br>         def eventFilter(self, obj, event):<br>                 if event.type() == QtCore.QEvent.MouseButtonRelease:<br>                         traceback.print_exc()<br>                 else:<br>                         print
event.type()<br>                 #Pass the event onto the parent window.<br>                 return QtCore.QObject.eventFilter(self, obj, event)<br><br>Then you just install the filter, like so, to everything that you suspect errors:<br>
QObject.installEventFilter(FilterObject)<br><br>Later, now that there would be a need for it, I could write up one that gives you an action instead of a number, but I'm not up for something so tedious at 0210 =]<br><br>
<br><div><span class="gmail_quote">On 9/7/07, <b class="gmail_sendername">Claudio A. Quezada R.</b> <<a href="mailto:claudio.quezada.r@gmail.com">claudio.quezada.r@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
Hello, iīve got the very same trouble several of times, and i tried to<br>reimplement notify, but the same exception was thrown over and over<br>again.<br><br>I changed the code (finding where was the error) and exception didnīt
<br>appear again. Itīs seems easier debug and change the code than<br>reimplement QApplication notify, at least for me. Probably silly<br>errors (like setItem to a QTableWidget that isnīt enabled, or setText<br>on a QTableWidgetItem that donīt exists) are common.
<br><br>Anyway, if anyone get QApplication notify works, post it at the list.<br><br>Cheers,<br><br>Claudio<br><br>2007/9/7, Allen Bierbaum <<a href="mailto:abierbaum@gmail.com">abierbaum@gmail.com</a>>:<br>> I don't know what you are doing wrong or what causes this, but I do
<br>> know that we see it all the time when trying to debug and it makes the<br>> entire process very painful. If you find any type of solution that<br>> works so you can see the exception that is being thrown, please let me
<br>> know so we can use it.<br>><br>> -Allen<br>><br>> On 9/7/07, Dirk Wagener <<a href="mailto:dwagen@stonethree.com">dwagen@stonethree.com</a>> wrote:<br>> > Hi<br>> ><br>> > I have a piece of code that produces this error:
<br>> ><br>> > "Qt has caught an exception thrown from an event handler. Throwing<br>> > exceptions from an event handler is not supported in Qt.<br>> > You must reimplement QApplication::notify() and catch all exceptions
<br>> > there. "<br>> ><br>> > I implemented my own app class as follows:<br>> ><br>> > class Application (QtGui.QApplication):<br>> > def __init__(self, argv):<br>> >
QtGui.QApplication.__init__(self, argv)<br>> ><br>> > def notify(self, obj, evt):<br>> > try:<br>> > # Call base class notify.<br>> > return QtGui.QApplication.notify
(self, obj, evt)<br>> > except Exception:<br>> > print "Unexpected error:",<br>> > string.join(traceback.format_exception(*sys.exc_info()))<br>> > return False
<br>> ><br>> > My code still produces exactly the same error, so it seems that the<br>> > exception is still not caught!<br>> > What am I doing wrong here?<br>> ><br>> > Kind regards<br>
> > Dirk Wagener<br>> > _______________________________________________<br>> > PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>> > <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">
http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>> ><br>> _______________________________________________<br>> PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com
</a><br>> <a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br>><br><br><br>--<br>Claudio Quezada Romegialli<br>Ingeniero Ambiental<br>(02)7321665 - 81466049
<br><br>_______________________________________________<br>PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br><a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">
http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br>