[PyQt] Automatic Crash Reporting

Florian Bruhin me at the-compiler.org
Thu Sep 25 05:41:57 BST 2014


* Timothy W. Grove <tim_grove at sil.org> [2014-09-25 04:15:53 +0100]:
> Can anyone recommend a good automatic crash reporting module that would work
> nicely with a python3/pyqt4 application? Thanks.

What are you looking for exactly? Some full-fledged (likely
commercial) solution [1] or just some simple error report dialog?

I've done the latter in my own project with much success. However it's
coupled to some other stuff in the project so I can't really give you
a ready solution, but feel free to rip out what you can need.

- It uses PyQt to display an error dialog with all the logs and a
  restart button: [2]
- It calls that dialog from sys.excepthook: [3]
- It uses the logging module to log all log calls (debug loglevel) to
  the RAM and shows that log then: [4]
- It also integrates Qt warnings and Python warnings in the same log.
- It uses the faulthandler module to write a crash dump on segfaults
  and then displays the report window on the next start: [5]
- Some other useful information is gathered (version information, OS
  information, their configfile, commandline arguments, list of Qt
  widgets/objects, etc.).
- When the user clicks "Report", the full crash log is automatically
  sent to my pastebin via urllib: [6]

An example crashdump is at [7]. It's been some effort to set this up,
but it has proven to be incredibely helpful for debugging issues.

Florian

[1] Some I've just found, with no idea how good they all are:
    https://raygun.io/landing/python-error-tracking
    https://www.getsentry.com/for/python/
    https://rollbar.com/
    https://airbrake.io/languages/python

[2] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/widgets/crash.py

[3] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/app.py?id=812a0fdd412e6493035870009c2152d756bd7251#n531

[4] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/utils/log.py

[5] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/app.py?id=812a0fdd412e6493035870009c2152d756bd7251#n310

[6] http://git.the-compiler.org/qutebrowser/tree/qutebrowser/utils/utils.py?id=f4876c7f4fdba1c0e3461a5cbfa3924d9a209ff5#n150

[7] http://paste.the-compiler.org/view/7775f403

-- 
http://www.the-compiler.org | me at the-compiler.org (Mail/XMPP)
             GPG 0xFD55A072 | http://the-compiler.org/pubkey.asc
         I love long mails! | http://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140925/7f520943/attachment.sig>


More information about the PyQt mailing list