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