<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">Curt,</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Thanks a lot for your help</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Bob<BR><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">----- Original Message ----<BR>From: Curt Hagenlocher <curt@hagenlocher.org><BR>To: Discussion of IronPython <users@lists.ironpython.com><BR>Sent: Friday, June 13, 2008 6:38:11 PM<BR>Subject: Re: [IronPython] Talk to Python script from C# app...<BR><BR>If this test worked, you should be able to just copy them onto the users' machine -- manually or using an installer.<BR><BR>
<DIV class=gmail_quote>On Fri, Jun 13, 2008 at 3:28 PM, Bob Rosembob <<A href="mailto:brosembob@yahoo.com" target=_blank rel=nofollow ymailto="mailto:brosembob@yahoo.com">brosembob@yahoo.com</A>> 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">I added bunch of files (.py), one at the time, before I could run the script and it works now.</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Do I need to include them into my installer and just copy them on the user's machine or I'll have to do something more then that?</DIV>
<DIV class=Ih2E3d>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Thanks for your help,</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Bob<BR><BR></DIV></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV class=Ih2E3d>----- Original Message ----<BR>From: Curt Hagenlocher <<A href="mailto:curt@hagenlocher.org" target=_blank rel=nofollow ymailto="mailto:curt@hagenlocher.org">curt@hagenlocher.org</A>><BR>To: Discussion of IronPython <<A href="mailto:users@lists.ironpython.com" target=_blank rel=nofollow ymailto="mailto:users@lists.ironpython.com">users@lists.ironpython.com</A>><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>Sent: Friday, June 13, 2008 1:51:23 PM<BR>Subject: Re: [IronPython] Talk to Python script from C# app...<BR><BR>There will be a "<A href="http://string.py/" target=_blank rel=nofollow>string.py</A>" in the lib directory of your Python 2.5 installation. You may need other files from this directory as well. <BR><BR>
<DIV class=gmail_quote>On Fri, Jun 13, 2008 at 10:30 AM, Bob Rosembob <<A href="mailto:brosembob@yahoo.com" target=_blank rel=nofollow ymailto="mailto:brosembob@yahoo.com">brosembob@yahoo.com</A>> 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">Curt,</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">I copied all the files (app.exe + <A href="http://cycle.py/" target=_blank rel=nofollow>cycle.py</A> + python.exe + python25.dll) to another PC, which doesn't have Python installed, and ran it. I got error saying that it can't import string module (No module named string). Any ideas?</DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"> </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Thanks, </DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">Bob<BR><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>----- Original Message ----<BR>From: Curt Hagenlocher <<A href="mailto:curt@hagenlocher.org" target=_blank rel=nofollow ymailto="mailto:curt@hagenlocher.org">curt@hagenlocher.org</A>><BR>To: Discussion of IronPython <<A href="mailto:users@lists.ironpython.com" target=_blank rel=nofollow ymailto="mailto:users@lists.ironpython.com">users@lists.ironpython.com</A>><BR></DIV>
<DIV>
<DIV></DIV>
<DIV>Sent: Thursday, June 12, 2008 3:18:09 PM<BR>Subject: Re: [IronPython] Talk to Python script from C# app...<BR><BR>
<DIV>Whether it's CPython or IronPython, you're going to have to deploy something to the user's PC if you want to run a Python program there. IronPython doesn't have any kind of installer; you just copy its modules over with your application. But your program almost certainly makes use of parts of the standard CPython library, which you'd then have to copy over as well.</DIV>
<DIV> </DIV>
<DIV>Even though CPython has an installer under Windows, I suspect you can still do an "xcopy deployment" 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're running python.exe. But you'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 <<A href="mailto:brosembob@yahoo.com" target=_blank rel=nofollow ymailto="mailto:brosembob@yahoo.com">brosembob@yahoo.com</A>> 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 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> </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>@"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.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>"-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.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"> </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 it on the user's PC or I can some how embed it into my application?</P>
<DIV>
<P> </P>
<P><FONT color=#434343>>>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...'.</FONT></P>
<P> </P></DIV>
<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> </P>
<P> </P></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>----- Original Message ----<BR>From: Michael Foord <<A href="mailto:fuzzyman@voidspace.org.uk" target=_blank rel=nofollow ymailto="mailto:fuzzyman@voidspace.org.uk">fuzzyman@voidspace.org.uk</A>><BR>To: Discussion of IronPython <<A href="mailto:users@lists.ironpython.com" target=_blank rel=nofollow ymailto="mailto:users@lists.ironpython.com">users@lists.ironpython.com</A>><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 rel=nofollow>http://www.ironpythoninaction.com/</A><BR><BR></DIV>
<DIV>Bob Rosembob wrote:<BR>> Hello there,<BR>> I have a C# application and a 3rd party Python script that the <BR>> application should run. The script is called periodical with some <BR>> arguments, performs some calculations and returns the results. I'm <BR>> running Vista & VS2005.<BR>> <BR>> What should I do to run the script from my application? I assume I <BR>> need to install IronPython on my PC. How exactly should I do it?<BR>> <BR>> Thanks for your help.<BR>> <BR>> Bob<BR>><BR>> ------------------------------------------------------------------------<BR>><BR>> _______________________________________________<BR>> Users mailing list<BR>> <A href="mailto:Users@lists.ironpython.com" target=_blank rel=nofollow 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
rel=nofollow>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</A><BR>> <BR><BR>_______________________________________________<BR>Users mailing list<BR><A href="mailto:Users@lists.ironpython.com" target=_blank rel=nofollow 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 rel=nofollow>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" target=_blank rel=nofollow 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
rel=nofollow>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV></DIV><BR></DIV><BR>_______________________________________________<BR>Users mailing list<BR><A href="mailto:Users@lists.ironpython.com" target=_blank rel=nofollow 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 rel=nofollow>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV></DIV><BR></DIV><BR>_______________________________________________<BR>Users mailing list<BR><A href="mailto:Users@lists.ironpython.com" target=_blank rel=nofollow 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
rel=nofollow>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></div><br>
</body></html>