[IronPython] Implementing sys.excepthook

Dan Eloff dan.eloff at gmail.com
Tue Apr 22 11:19:34 PDT 2008


I really want to see sys.excepthook in IronPython.

The way I see it there's two problems.

1) You cannot assign to the sys module. So we need a fix or workaround
for that. This is the hard part.

2) We also need to intercept exceptions before they leave IPY and
route them to sys.excepthook, which should be set to __excepthook__ by
default, which needs to be a function that raises the exception in the
way they would have been before interception.

I have no idea how to assess the complexity of these problems, or how
to solve them. I'm quite happy to offer any help required here, but
I'll need some direction.

I have created and embedded an IronPython interactive interpreter into
my Silverlight application. I want to use sys.excepthook to catch
exceptions, print them in the console, and have a combo box of stack
frames that you can jump around and inspect on the fly (like Wing
IDE's debug probe.) It would also work with little or no modification
in WPF applications. I've done similar things with CPython and
wxPython, and found that it really speeds up the development cycle. I
want to have the same functionality in IronPython.

-Dan


More information about the Users mailing list