[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: Application quits on python exception
From:       John Thornton <dev () gnipsel ! com>
Date:       2023-12-13 21:54:03
Message-ID: bae12f89-0a7c-1674-c3c5-9aeb4c5f7f19 () gnipsel ! com
[Download RAW message or body]

Not sure if this helps or not but in my main class in the init I have 
this line

         sys.excepthook = self.excepthook

Then this function catches most errors.

     def excepthook(self, exc_type, exc_value, tb):
         # extract the stack summary
         summary = traceback.extract_tb(tb)
         for frame_summary in summary:
             filename = frame_summary.filename
             frame_summary.filename = os.path.relpath(filename)

         # rebuild the traceback and build the error message
         msg = f'Mesact Version: {VERSION} Build Date: {BUILD_DATE}\n'
         msg += 
''.join(traceback.format_list(StackSummary.from_list(summary)))
         msg += f'{exc_type.__name__}\n'
         msg += f'{exc_value}\n'
         msg += 'Please file an issue at\n'
         msg += 'https://github.com/jethornton/mesact/issues'
         print(msg)
         dialogs.errorMsgOk(msg, 'PROGRAM ERROR' )

This catches most errors and pops up a mesage box with the error.

If this is not what you're asking sorry for the static.

JT

On 12/13/23 14:16, Patrick Stinson wrote:
> I’ve been using PyQt for years but this is my first pyqt6 app.
> 
> It looks like new behavior that QApplication quits on the first python exception? \
> Is there a way to disable this? Or am I spacing out something? 
> Cheers,
> -Patrick
> 
> 
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic