StandardError exceptions in message handlers not shown in debug?

I posted this in the Boa mailing list but had no response, so I'm
cross-posting here.

We've noticed that if there is a coding error in a message handler, for a
menu say, that it is not shown at all in Boa when in debug mode.

If you are single stepping through code and you have an error e.g. trying
to access an attribute that doesn't exist, the target program just
starts running again - debug finishes.

If you're running outside Boa and the debugger the cmd window associated
with the Python program shows an exception.

One solution is to put try/except around the content of every message
handler, catching StandardError. Using something like ErrorDialog.py from
http://starship.python.net/crew/hochberg/ gives more information to the
user.

Is there something that we're missing? Is there some setting that will
catch and show these exceptions?

Hugh Gibson

Hugh Gibson wrote:

I posted this in the Boa mailing list but had no response, so I'm cross-posting here.

We've noticed that if there is a coding error in a message handler, for a menu say, that it is not shown at all in Boa when in debug mode.

If you are single stepping through code and you have an error e.g. trying to access an attribute that doesn't exist, the target program just starts running again - debug finishes.

If you're running outside Boa and the debugger the cmd window associated with the Python program shows an exception.

I guess Boa catches the stderr of the app it runs. Isn't there an option to display that?

One solution is to put try/except around the content of every message handler, catching StandardError. Using something like ErrorDialog.py from http://starship.python.net/crew/hochberg/ gives more information to the user.

Is there something that we're missing? Is there some setting that will catch and show these exceptions?

Not from wxPython. The issue is the C++/Python sandwich that you end up with when calls are made from Python --> C++ --> Python --> etc. with event handlers and other callbacks. There currently isn't a safe way for me to pass the exceptions from one Python layer across C++ to another Python layer so instead I just call PyErr_Print() upon return from a Python call.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!