[Tutor] Rerouting a traceback

Mats Wichmann mats at wichmann.us
Mon Jan 25 22:15:02 EST 2021


On 1/25/21 7:21 PM, Jim Byrnes wrote:
> Linux Mint 20 - Python 3.8
> 
> Is it possible to reroute a traceback to a GUI wintow?

It's software, so it's possible...

> 
> Here's why I ask. I usually run scripts using a launcher app on my top 
> panel.  The scripts download stock data and then manipulate it in 
> Libreoffice calc. The execution time varies. After a while if nothing 
> appears in calc I assume there was an error and must re-launch the 
> script from a terminal to see what went wrong.
> 
> It would be helpful if I could display the error when it occurs in popup 
> window.
> 
> I've googled it but so far haven't found any help. I've used pysimplegui 
> on occasion and thought maybe it's debug window would do the trick but 
> so far I haven't been able to figure anything out.
> 
> So before I waste anymore time on this I would like to know if it is 
> possible and maybe a hint on how to do it if it is possible.

If the script you launch is your own - that is, if you feel like 
modifying it - it can just pop up a simple message box. This might end 
up being sufficient:

from tkinter import messagebox

messagebox.showerror("FAILED", "error message from the failure")


but you'll need to ampliy what you need and who controls what in this 
scenario, it might be more complicated.


More information about the Tutor mailing list