> 
> Hello all,
> 
> I'm trying to figure out a way to capture python traceback
> messages that are apparently caught in the pyqt event loop
> and issued to stdout.
> 
> For example, in the attached sample program, I would like
> the tracebacks that occur when the 'Error' button is clicked
> to be displayed in the multi line edit as well as stdout.
> 
> I thought about implementing the event loop in my PyQApplication
> sub-class but could not find enough info to do it.  Has anyone
> else done this?
> 

Hi Dave,

The low-level approach might be to install your own excepthook (see sys
module).  For example, you can add the following function to your code:

def myExceptHook(type, value, tb):
   import traceback, string
   global multiLineEdit
   sys.__excepthook__(type, value, tb)
   lines = traceback.format_exception(type, value, tb)
   multiLineEdit.append(string.join(lines))

Then you can install it in your main function perhaps just before calling
exec_loop:

   sys.excepthook = myExceptHook
   appTopLevel.exec_loop()

Hope that helps,
Paul
begin:vcard 
n:Felix;Paul
tel;work:603-643-2600
x-mozilla-html:FALSE
url:www.fluent.com
org:Fluent Inc.
adr:;;10 Cavendish Ct.;Lebanon;NH;03766;USA
version:2.1
email;internet:[EMAIL PROTECTED]
title:Software Development
fn:Paul Felix
end:vcard

Reply via email to