tatamata wrote:
> Hello.
>
> How can I run some Python script within C# program?
>
---------------------------------------------------------------------------------
ProcessStartInfo startInfo;
Process process;
string directory;
string pyArgs;
string script;
startInfo = new ProcessStartInfo("python");
startInfo.WorkingDirectory = directory;
startInfo.Arguments = script + " " + pyArgs;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
process = new Process();
process.StartInfo = startInfo;
process.Start();
string s;
while ((s = process.StandardOutput.ReadLine()) != null)
{
//do something with s
}
---------------------------------------------------------------------------------
HTH
Gerard
--
http://mail.python.org/mailman/listinfo/python-list