[Tutor] Rerouting a traceback
Alan Gauld
alan.gauld at yahoo.co.uk
Tue Jan 26 04:42:00 EST 2021
On 26/01/2021 02:21, Jim Byrnes wrote:
> Linux Mint 20 - Python 3.8
>
> Is it possible to reroute a traceback to a GUI wintow?
>
> Here's why I ask. I usually run scripts using a launcher app on my top
> panel.
The simplest way is put the launcher into a bash shell.
redirect stderr into a /tmp/file. If the file exists at the
end of execution launch (or if it contains an error string?)
launch your favourite GUI editor on the file.
It is a fairly trivial bash script and exactly the
kind of thing that bash scripts are intended for..
Something like:
#! /bin/bash
python3 myscript.py any args here 2> /tmp/myscript_errors
[ -e /tmp/myscript_errors] && xedit /tmp/myscript_errors &
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list