<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);">
<div>
<div>
<div>
<div><font size="2"><span style="font-size:11pt">On Sun, May 26, 2019 at 04:52:20PM -0400, Kyle Altendorf wrote:<br>
</span></font></div>
</div>
</div>
</div>
<div>
<div>
<div><font size="2"><span style="font-size:11pt">> On 2019-05-26 16:37, Matic Kukovec wrote:<br>
> <br>
> > Hi guys,<br>
> > <br>
> > I have an application that runs without a problem on Windows, but on<br>
> > Linux it shows this message on exit:<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 not let any exception whatsoever propagate through Qt code.<br>
> > > If that is not possible, in Qt 5 you must at least reimplement<br>
> > > QCoreApplication::notify() and catch all exceptions there.<br>
> <br>
> I use sys.excepthook to provide a log and dialog for otherwise unhandled<br>
> Python exceptions.  Maybe see if that can at least let you see what<br>
> exception is causing trouble?  But I honestly haven't ever seen a reference<br>
> to this message before...  :|<br>
<br>
That message is coming from Qt, which doesn't know about Python exceptions.<br>
<br>
I'm guessing it's referring to C++ exceptions, which you won't catch in Python<br>
via an excepthook or "except".<br>
<br>
So the question is why there's a C++ exception thrown, and from where... No<br>
idea how to debug that to be honest. Maybe you can get gdb to break on any<br>
exception or something?<br>
<br>
</span></font></div>
<div><font size="2"><span style="font-size:11pt">Florian</span></font></div>
</div>
</div>
</blockquote>
<div>
<blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);">
<font size="2"><span style="font-size:11pt"><br>
The first step is to get some more information regarding the exception <br>
trace. The exception traceback has tb_frame and tb_next attributes to <br>
build a frames stack. Each frame has its own frame.f_code.co_name, <br>
frame.f_code.co_filename, frame.f_lineno and local stack variables <br>
(frame.f_locals).<br>
<br>
-- <br>
</span></font>
<div><font size="2"><span style="font-size:11pt">Giuseppe Corbelli</span></font><font size="2"><span style="font-size:11pt"><br>
</span></font></div>
</blockquote>
<div><br>
</div>
<div>Thanks for the suggestions guys!</div>
<div><br>
</div>
<div>I added a <i>faulthandler </i>to my application and added an exception handler in an overridden<br>
</div>
<div><i>QApplication.notify</i> and it pointed me to a queue implementation i have, that uses signals/slots for input</div>
<div>and output, and it seems that a exception happens in there and only on Linux.</div>
<div>I'm still hunting it down, but at least now I know where to look.</div>
<div><br>
</div>
<div>This SO post also helped me to figure out that exceptions in a slot are sometimes not propagated up:</div>
<div><a href="https://stackoverflow.com/questions/18740884/preventing-pyqt-to-silence-exceptions-occurring-in-slots" id="LPNoLP417274">https://stackoverflow.com/questions/18740884/preventing-pyqt-to-silence-exceptions-occurring-in-slots</a><br>
</div>
<br>
<div><br>
</div>
<div>Thanks again,<br>
</div>
<div>Matic<br>
</div>
</div>
<br>
</div>
</body>
</html>