<div>Whether it&#39;s CPython or IronPython, you&#39;re going to have to deploy something to the user&#39;s PC if you want to run a Python program there.&nbsp; IronPython doesn&#39;t have any kind of installer; you just copy its modules over with your application.&nbsp; But your program almost certainly makes use of parts of the standard CPython library, which you&#39;d then have to copy over as well.</div>

<div>&nbsp;</div>
<div>Even though CPython has an installer under Windows, I suspect you can still do an &quot;xcopy deployment&quot; of it to most machines provided that you also grab a copy of Python25.dll from the Windows directory.<br>
</div>
<div>To try with IronPython,</div>
<div>You can run ipy.exe the same way as you&#39;re running python.exe.&nbsp; But you&#39;d want to try this from a command prompt first before going to the trouble of changing your C# program.<br></div>
<div class="gmail_quote">On Wed, Jun 11, 2008 at 3:40 PM, Bob Rosembob &lt;<a href="mailto:brosembob@yahoo.com">brosembob@yahoo.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Thank you&nbsp;Michael and Curt for your quick response. </div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">I got the script working using the following logic:</div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><font color="#0000ff" size="2"><font color="#0000ff" size="2">
<p>&nbsp;</p>
<p>private</p></font></font><font size="2"></font><font color="#2b91af" size="2"><font color="#2b91af" size="2">Process</font></font><font size="2"> P;</font> 
<p><font size="2">...</font></p></div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><font size="2"></font><font color="#0000ff" size="2"><font color="#0000ff" size="2"><font size="2">
<p></p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">string</font></font><font size="2"> python = </font><font color="#a31515" size="2"><font color="#a31515" size="2">@&quot;C:\Python25\python.exe&quot;</font></font><font size="2">; 
<p></p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">string</font></font><font size="2"> pyscript = </font><font color="#a31515" size="2"><font color="#a31515" size="2">@&quot;IronPython\cycle_LR.py&quot;</font></font><font size="2">; 
<p>P = </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">Process</font></font><font size="2">(); 
<p>P.OutputDataReceived += </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">DataReceivedEventHandler</font></font><font size="2">(OnOutputDataReceived); 
<p>P.ErrorDataReceived += </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">new</font></font><font size="2"> </font><font color="#2b91af" size="2"><font color="#2b91af" size="2">DataReceivedEventHandler</font></font><font size="2">(OnErrorReceived); 
<p>P.StartInfo.UseShellExecute = </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">false</font></font><font size="2">; 
<p>P.StartInfo.RedirectStandardOutput = </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">true</font></font><font size="2">; 
<p>P.StartInfo.RedirectStandardError = </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">true</font></font><font size="2">; 
<p>P.StartInfo.CreateNoWindow = </p></font><font color="#0000ff" size="2"><font color="#0000ff" size="2">true</font></font><font size="2">; 
<p>P.StartInfo.FileName = @python.ToString();</p>
<p>P.StartInfo.Arguments = </p></font><font color="#a31515" size="2"><font color="#a31515" size="2">&quot;-u &quot;</font></font><font size="2"> + pyscript.ToString() + </font><font color="#a31515" size="2"><font color="#a31515" size="2">@&quot; IronPython\cycle.ini&quot;</font></font><font size="2">; 
<p>P.Start();</p>
<p>P.BeginOutputReadLine();</p>
<p>P.BeginErrorReadLine();</p></font></font></font></div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">&nbsp;</div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<p>As you probably guessed I installed latest Python 2.5.2 on my machine. </p>
<p>Now, do I need to include Python 2.5.2 into my deployment package and install&nbsp;it on the user&#39;s PC or I can some how embed it into my application?</p>
<div class="Ih2E3d">
<p>&nbsp;</p>
<p><font color="#434343">&gt;&gt;If the former then you can use System.Process to launch the script with <br>&gt;&gt;IronPython. You will need to download (rather than install) and launch <br>&gt;&gt;the script with &#39;ipy.exe args...&#39;.</font></p>

<p>&nbsp;</p></div>
<p>Wouldn&#39;t this approach be simpler, since I don&#39;t have to install python on user&#39;s PC? How exactly can I run ipy.exe with the args?<br></p>
<p>Curt, </p>
<p>The script that I have to use was created in 2004 and probably was not tested with IronPython. The guy who created it left the company and nobody modified the script since.</p>
<p><br>Thank you very much,</p>
<p>Bob</p>
<p>&nbsp;</p>
<p>&nbsp;</p></div>
<div style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<div class="Ih2E3d">----- Original Message ----<br>From: Michael Foord &lt;<a href="mailto:fuzzyman@voidspace.org.uk" target="_blank">fuzzyman@voidspace.org.uk</a>&gt;<br>To: Discussion of IronPython &lt;<a href="mailto:users@lists.ironpython.com" target="_blank">users@lists.ironpython.com</a>&gt;<br>
Sent: Wednesday, June 11, 2008 1:29:27 PM<br>Subject: Re: [IronPython] Talk to Python script from C# app...<br><br>Hello Bob,<br><br>The question is, do you want to run it in the same way you would launch <br>any command line application from C# and collect the results from <br>
standard out - or do you want to embed IronPython and run the script <br>&#39;inside&#39; your application?<br><br>If the former then you can use System.Process to launch the script with <br>IronPython. You will need to download (rather than install) and launch <br>
the script with &#39;ipy.exe args...&#39;.<br><br>If the latter then how you do it depends on whether you use IronPython 1 <br>or 2 and what exactly your use case is.<br><br>Michael Foord<br><a href="http://www.ironpythoninaction.com/" target="_blank">http://www.ironpythoninaction.com/</a><br>
<br></div>
<div class="Ih2E3d">Bob Rosembob wrote:<br>&gt; Hello there,<br>&gt; I have a C# application and a 3rd party Python script that the <br>&gt; application should run. The script is called periodical with some <br>&gt; arguments, performs some calculations and returns the results. I&#39;m <br>
&gt; running Vista &amp; VS2005.<br>&gt;&nbsp; <br>&gt; What should I do to run the script from my application? I assume I <br>&gt; need to install IronPython on my PC. How exactly should I do it?<br>&gt;&nbsp; <br>&gt; Thanks for your help.<br>
&gt;&nbsp; <br>&gt; Bob<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; Users mailing list<br>&gt; <a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br>
&gt; <a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>&gt;&nbsp; <br><br>_______________________________________________<br>
Users mailing list<br><a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</div></div></div><br></div><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" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
<br></blockquote></div><br>