[IronPython] IronPython and Threads

Dino Viehland dinov at exchange.microsoft.com
Sun Jun 8 19:00:33 PDT 2008


Yep, we actually have a pretty good spec on the hosting APIs.  It's available over at http://compilerlab.members.winisp.net/

The direct links are:

Doc: http://compilerlab.members.winisp.net/dlr-spec-hosting.doc
PDF: http://compilerlab.members.winisp.net/dlr-spec-hosting.pdf


-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dan Eloff
Sent: Sunday, June 08, 2008 6:18 PM
To: Discussion of IronPython
Subject: Re: [IronPython] IronPython and Threads

On Sun, Jun 8, 2008 at 7:44 PM, Dino Viehland
<dinov at exchange.microsoft.com> 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
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


More information about the Users mailing list