<br><div><span class="gmail_quote">On 26 Jan 2008 14:54:56 -0500, <b class="gmail_sendername">Craig S. Perler 04</b> <<a href="mailto:Craig.S.Perler.04@alum.dartmouth.org">Craig.S.Perler.04@alum.dartmouth.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The DLLs I'm currently referencing and experiencing<br>problems with are the ones that downloaded with<br>Silverlight 1.1...</blockquote><div><br><br>
Ah - I misunderstood the discussion. I'll try compiling the code on my system and see what happens.<br>
<br>
Michael<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">---Discussion of IronPython <<a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a>><br>
wrote ---<br>Craig S. Perler 04 wrote:<br>> Hi Jimmy,<br>><br>> You're correct, I'm trying to host IronPython in an<br>> existing C# SL app and I would like to use the .NET<br>> libraries from IronPython. I hadn't realized or<br>
noticed,<br>> however, that the dlls shipped with SL are not the same<br>as<br>> those available for production use from IronPython<br>> directly. My app references IronPython.dll version<br>> <a href="http://2.0.0.0">2.0.0.0</a>, runtime version 2.0.50727, file version<br>
> 1.1.20625.0. Is there a more appropriate and still SL<br>> compatible version to use?<br>><br>><br><br>What is the reason not to use the version of IronPython<br>that ships with<br>Silverlight?<br><br>To use any other you will have to compile from source,<br>
targeting<br>Silverlight. This should work though - you shouldn't just<br>drop in DLLs<br>that weren't compiled for Silverlight.<br><br>What you are aiming to do seems straightforward enough.<br><br>Michael<br><br>
> That aside, the IronPython-relevant aspect of my app is<br>> straightforward: grab a string from a textbox, pass it<br>via<br>> JavaScript to SL, and then attempt to execute it via<br>> IronPython.<br>><br>
> The C# method that handles this process is below. It<br>> takes the string from JavaScript, and then executes it<br>as<br>> Python code. For the sake of debugging at first at<br>least,<br>> it then assumes that a function "func" was defined, as<br>
> that's then evaluated.<br>><br>> [Scriptable]<br>> public void Execute(string script)<br>> {<br>> try<br>> {<br>> PythonEngine engine =<br>> PythonEngine.CurrentEngine;<br>
> engine.Execute(script);<br>> object result = engine.Evaluate("func()");<br>><br>> if (result != null)<br>> {<br>> Debug.WriteLine(result);<br>
> }<br>> }<br>> catch (Exception e)<br>> {<br>> Debug.WriteLine(e);<br>> }<br>> }<br>><br>> Prior to any execution as per above, I initialize PAL<br>
> exactly as described here:<br>><br>[<a href="http://www.voidspace.org.uk/ironpython/silverlight/embeddi">http://www.voidspace.org.uk/ironpython/silverlight/embeddi</a><br>> ng_ironpython.shtml].<br>><br>> Thoughts on what I'm doing wrong?<br>
><br>> Thanks again,<br>><br>> -Craig<br>><br>> ---Discussion of IronPython <<a href="mailto:users@lists.ironpython.com">users@lists.ironpython.com</a>><br>> wrote ---<br>><br>>> Craig S. Perler wrote:<br>
>><br>>> I'm having problems accessing .NET libraries from<br>>> IronPython hosted within a Silverlight application and<br>>> have hit a wall. If you have any advice, I'd be most<br>>> appreciative!<br>
>><br>><br>> The work around for hosting IronPython in Silverlight<br>1.1<br>> is a little messy, since the DLR should take care of<br>this<br>> and not require the user's app to override the PAL. We<br>
are<br>> revisiting this for the next release of Silverlight to<br>> make it work well.<br>><br>> I assume you'd like to host IronPython in an existing C#<br>> SL app? If you can do without C# code, and without the<br>
> bleeding edge IronPython version ... you could just use<br>> the IronPython version shipped in Silverlight. There are<br>> samples on <a href="http://silverlight.net">silverlight.net</a> if you'd like examples on how<br>
> to do it.<br>><br>><br>>> To describe my setup... I'm first initializing the<br>>> PlatformAdaptationLayer with the details described here<br>>><br>>><br>><br>[<a href="http://www.voidspace.org.uk/ironpython/silverlight/embeddi">http://www.voidspace.org.uk/ironpython/silverlight/embeddi</a><br>
><br>>> ng_ironpython.shtml]. I'm not certain what exactly that<br>>> does, but it seems clear that no amount of fiddling<br>>><br>> around<br>><br>>> in IronPython works without detailing the<br>
>> ScriptEnvironmentSetup. With that in place, I see a bit<br>>><br>> of<br>><br>>> progress: I can execute the script "def func():\r\n<br>>> return 'in Func()'" and then retrieve the result by<br>
>> evaluating the script "func()".<br>>><br>>> I've tried a variety of combinations to gain access to<br>>> System.DateTime from the Python script, but they all end<br>>> up with an error like the one below. Additionally, this<br>
>> error is also similar to the one I receive when<br>>><br>> attempting<br>><br>>> to call PythonEngine.ExecuteFile(string path), which I<br>>> have thus far been unable to get to work.<br>>><br>
><br>> Can you send me the source or a smaller repro of the<br>> issue? Michael, did you run into any of these issues?<br>><br>> ~Jimmy<br>> _______________________________________________<br>> Users mailing list<br>
> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>> <a href="http://lists.ironpython.com/listinfo.cgi/users-">http://lists.ironpython.com/listinfo.cgi/users-</a><br>> <a href="http://ironpython.com">ironpython.com</a><br>
> --- End of quote ---<br>> _______________________________________________<br>> Users mailing list<br>> <a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>> <a href="http://lists.ironpython.com/listinfo.cgi/users-">http://lists.ironpython.com/listinfo.cgi/users-</a><br>
<a href="http://ironpython.com">ironpython.com</a><br>><br>><br>><br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br>
<a href="http://lists.ironpython.com/listinfo.cgi/users-">http://lists.ironpython.com/listinfo.cgi/users-</a><br><a href="http://ironpython.com">ironpython.com</a><br>--- End of quote ---<br>_______________________________________________<br>
Users mailing list<br><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.manning.com/foord">http://www.manning.com/foord</a><br><a href="http://www.voidspace.org.uk">http://www.voidspace.org.uk</a><br><a href="http://www.ironpython.info">http://www.ironpython.info</a>