Have you tried using the PythonEngine.RunString (not RunSimpleString) method?
Still not as convenient as having a RunFile, but that should do what you need for now. -Brian > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of LIVERNAIS Sylvie > Sent: Thursday, June 01, 2006 11:08 AM > To: pythondotnet@python.org > Subject: [Python.NET] How to run a .py file from C# > > Hi, > > I'm a newbie in C# and python and try to run a .py file from > a C# program. > > I tried the same thing from a C++ program using > PyRun_SimpleFile and in the console, I could see the python > execution (the print from python). > > Using Python.Runtime.dll from Python.NET, I saw that such a > fonction is not available, and should use > PythonEngine.ImportModule and PythonEngine.RunString or > PythonEngine.RunSimpleString. The thing is that it only works > for a command written over one line, but if I have a "def" > (which is written over several lines), the RunString doesn't > work any more... So how can I run the whole file, and not > only line by line ? > > By the way, what does exactly the ImportModule function ? > Maybe the .py file is already executed but I can't see it ? > Is there a way to get the output and display it in the console ? > > Thanks for you answer > > __ Sylvie LIVERNAIS ___________ > Applications Cartes à Puce > EID > * : +33 (0) 388 14 28 75 > > _________________________________________________ Python.NET mailing list - PythonDotNet@python.org http://mail.python.org/mailman/listinfo/pythondotnet