Curt, I copied all the files (app.exe + cycle.py + 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? Thanks, Bob
----- Original Message ---- From: Curt Hagenlocher <[EMAIL PROTECTED]> To: Discussion of IronPython <users@lists.ironpython.com> Sent: Thursday, June 12, 2008 3:18:09 PM Subject: Re: [IronPython] Talk to Python script from C# app... 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. 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. To try with IronPython, 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. On Wed, Jun 11, 2008 at 3:40 PM, Bob Rosembob <[EMAIL PROTECTED]> wrote: Thank you Michael and Curt for your quick response. I got the script working using the following logic: privateProcessP; ... stringpython = @"C:\Python25\python.exe"; stringpyscript = @"IronPython\cycle_LR.py"; P = newProcess(); P.OutputDataReceived += newDataReceivedEventHandler(OnOutputDataReceived); P.ErrorDataReceived += newDataReceivedEventHandler(OnErrorReceived); P.StartInfo.UseShellExecute = false; P.StartInfo.RedirectStandardOutput = true; P.StartInfo.RedirectStandardError = true; P.StartInfo.CreateNoWindow = true; P.StartInfo.FileName = @python.ToString(); P.StartInfo.Arguments = "-u "+ pyscript.ToString() + @" IronPython\cycle.ini"; P.Start(); P.BeginOutputReadLine(); P.BeginErrorReadLine(); As you probably guessed I installed latest Python 2.5.2 on my machine. 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? >>If the former then you can use System.Process to launch the script with >>IronPython. You will need to download (rather than install) and launch >>the script with 'ipy.exe args...'. 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? Curt, 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. Thank you very much, Bob ----- Original Message ---- From: Michael Foord <[EMAIL PROTECTED]> To: Discussion of IronPython <users@lists.ironpython.com> Sent: Wednesday, June 11, 2008 1:29:27 PM Subject: Re: [IronPython] Talk to Python script from C# app... Hello Bob, The question is, do you want to run it in the same way you would launch any command line application from C# and collect the results from standard out - or do you want to embed IronPython and run the script 'inside' your application? If the former then you can use System.Process to launch the script with IronPython. You will need to download (rather than install) and launch the script with 'ipy.exe args...'. If the latter then how you do it depends on whether you use IronPython 1 or 2 and what exactly your use case is. Michael Foord http://www.ironpythoninaction.com/ Bob Rosembob wrote: > Hello there, > I have a C# application and a 3rd party Python script that the > application should run. The script is called periodical with some > arguments, performs some calculations and returns the results. I'm > running Vista & VS2005. > > What should I do to run the script from my application? I assume I > need to install IronPython on my PC. How exactly should I do it? > > Thanks for your help. > > Bob > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com