<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><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</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>
<P><FONT size=2>...</P></FONT></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></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>@"C:\Python25\python.exe"</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>@"IronPython\cycle_LR.py"</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>P.OutputDataReceived += </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>P.ErrorDataReceived += </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>P.StartInfo.UseShellExecute = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>false</FONT></FONT><FONT size=2>;</P>
<P>P.StartInfo.RedirectStandardOutput = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;</P>
<P>P.StartInfo.RedirectStandardError = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;</P>
<P>P.StartInfo.CreateNoWindow = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>true</FONT></FONT><FONT size=2>;</P>
<P>P.StartInfo.FileName = @python.ToString();</P>
<P>P.StartInfo.Arguments = </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"-u "</FONT></FONT><FONT size=2> + pyscript.ToString() + </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>@" IronPython\cycle.ini"</FONT></FONT><FONT size=2>;</P>
<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's PC or I can some how embed it into my application?</P>
<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 'ipy.exe args...'.</FONT></P>
<P>&nbsp;</P>
<P>Wouldn't this approach be simpler, since I don't have to install python on user'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">----- Original Message ----<BR>From: Michael Foord &lt;fuzzyman@voidspace.org.uk&gt;<BR>To: Discussion of IronPython &lt;users@lists.ironpython.com&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>'inside' 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 'ipy.exe args...'.<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>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'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" ymailto="mailto:Users@lists.ironpython.com">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" ymailto="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></DIV></div><br>

      </body></html>