[wingide-users] Matlab like debugging in wing

Wingware Support support at wingware.com
Wed Oct 21 11:45:27 MDT 2009

Krishna Sandeep Reddy wrote:
> Hi,
> I would like to know if there is matlab like debugging in wing.
> In wing, if I normally run a program and if an error occurs, it simply
> exits and I cannot probe further.
> But if I run in debug mode, it is too slow. Is it possible to run a
> program normally but when an error occurs
> it should stop with some stack data so user can probe further. This
> may not have be the default but at least there should
> be option for user to select. Matlab exactly does this. The user can
> select whether it should stop when error occurs.
> This will be very helpful if the program is very time consuming.

One way to do this is to put a catch-all exception handler into your
debug program and in the except clause for errors initiate debug
using wingdbstub.  Then it runs outside of debug until the exception
occurs.  You can use a bare "raise" clause after importing wingdbstub
to re-raise the exception so it's reported in Wing, or set a breakpoint.

This isn't optimal in that you'll be in the except clause rather than
at the point of failure, but it may work for what you need.

It may also be possible to hook this into sys.excepthook, although if
you replace that be sure to call the original sys.excepthook also.

Details in using wingdbstub are here:



Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list