GUI Error Handler for PyQt 5.x

When I was developing programs with PyGTK, one of my favourite little things to include to make life better for users was a drop-in helper named which adds a GUI traceback handler for uncaught exceptions.

Well, I finally got around to porting it to PyQt 5.x for one of my more recent projects, and I’ve named it (what else?)

The original was under “The license is whatever you want.” terms, so, out of respect of the original author’s intentions, I’m releasing the port into the public domain rather than putting it under a permissive license (eg. MIT) like I usually would for a something like this (simple, and I want everyone to use it).

I’ve also done a lot of refactoring to make it more maintainable.

Admittedly, there’s still a little more I’d like to do, and it doesn’t have any automated tests yet, but manual testing seems to give it a clean bill of health and I added a fallback so that, if the most complicated code does contain a bug and that bug triggers an exception, it’ll fall back to a more primitive exception-formatting mechanism (plus a traceback for the more advanced code) rather than failing entirely.

Finally (and, from a user’s perspective, most importantly), I took the liberty of splitting out the old email-based option for one-click reporting of bugs into a callback so you can swap in something more modern (eg. like an HTTP POST) if you so choose.

The code contains a working if __name__ == '__main__' example which can be switched between no callback and localhost-based e-mail reporting just by swapping some comments, so it should be pretty self-explanatory. Enjoy. 🙂

CC BY-SA 4.0 GUI Error Handler for PyQt 5.x by Stephan Sokolow is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

This entry was posted in Geek Stuff. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution under the same terms as the associated post.

All comments are moderated. If your comment is generic enough to apply to any post, it will be assumed to be spam. Borderline comments will have their URL field erased before being approved.