Ive been writing a number of small plugins for use in QGIS, and have found that during development having the traceback calls reporting to the python console plugin to be quite useful.

I Use QGIS on three machines, but have found that now on two of these, all the python errors/tracebacks are going through the generic Python Error Dialog - this only occurs if there is an error on startup of the plugin on the machine which reports the traceback to the python console.

Does anyone know how I may be able to set the behaviour back to reporting to the python console instead of the dialog box?

1 Answer 1


Try putting:

sys.excepthook = sys.__excepthook__

at the start of your script

  • Not sure I would do that because QGIS uses that to hook the exceptions to show other errors. A better option to dump logging information to the log window and not use the Python console.
    – Nathan W
    Apr 14, 2015 at 1:57
  • What about for a standalone script though?
    – ndawson
    Apr 14, 2015 at 1:58
  • Standalone is fine but the OP is writing plugins.
    – Nathan W
    Apr 14, 2015 at 1:59
  • @Nathan W This seems to replicate the behaviour- but why would this be the default behaviour in some installs? All are 2.8.1, and all running the same plugin, but different error logging behaviour. This has also been the behaviour experienced in versions all the way to at least 2.2
    – valheran
    Apr 14, 2015 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.