[IronPython] IronPython & Silverlight

Jimmy Schementi Jimmy.Schementi at microsoft.com
Tue Jan 22 23:13:34 CET 2008

> Craig S. Perler wrote:
> I'm having problems accessing .NET libraries from
> IronPython hosted within a Silverlight application and
> have hit a wall. If you have any advice, I'd be most
> appreciative!

The work around for hosting IronPython in Silverlight 1.1 is a little messy, since the DLR should take care of this and not require the user's app to override the PAL. We are revisiting this for the next release of Silverlight to make it work well.

I assume you'd like to host IronPython in an existing C# SL app? If you can do without C# code, and without the bleeding edge IronPython version ... you could just use the IronPython version shipped in Silverlight. There are samples on silverlight.net if you'd like examples on how to do it.

> To describe my setup... I'm first initializing the
> PlatformAdaptationLayer with the details described here
> [http://www.voidspace.org.uk/ironpython/silverlight/embeddi
> ng_ironpython.shtml]. I'm not certain what exactly that
> does, but it seems clear that no amount of fiddling around
> in IronPython works without detailing the
> ScriptEnvironmentSetup. With that in place, I see a bit of
> progress: I can execute the script "def func():\r\n
> return 'in Func()'" and then retrieve the result by
> evaluating the script "func()".
> I've tried a variety of combinations to gain access to
> System.DateTime from the Python script, but they all end
> up with an error like the one below. Additionally, this
> error is also similar to the one I receive when attempting
> to call PythonEngine.ExecuteFile(string path), which I
> have thus far been unable to get to work.

Can you send me the source or a smaller repro of the issue? Michael, did you run into any of these issues?


More information about the Ironpython-users mailing list