On Sun, Jun 8, 2008 at 7:44 PM, Dino Viehland
<[EMAIL PROTECTED]> wrote:
> There's a DLR hosting API for formatting exceptions -
> ScriptEngine.FormatException.
>
> >From Silverlight I think you can access the DynamicApplication class, in
> >Microsoft.Scripting.Silverlight, which gives you access to the current
> >ScriptRuntime . You might need a clr.AddReference to
> >Microsoft.Scripting.Silverlight in there. From there you can get the
> >ScriptEngine for Python and then call FormatException on the exception
> >object. And that will give you the Python stack trace as we normally
> >display it.
def excepthook(sender, e):
print
Application.Current.Environment.GetEngine('py').FormatException(e.ExceptionObject)
Thanks! Works like a charm. Now I see exceptions on any thread without
having to add try/except clauses all over. Btw, is there anywhere to
get documentation on things like ScriptRuntime? I had to dig through
the IronPython source to figure out how to get the engine.
Many thanks to everyone here who took the time to respond on Sunday!
-Dan
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com