First off this is some is a dup (somewhat) of this: Running a python script on C# not working
My python script runs correctly from the command line as it is suppose to but when I run it from the console application it doesn't run correctly.
My python script is suppose to take all the .log files from a directory and pasrse them into a csv file. I then want to access the csv file from my C# console application. At the moment when I run the python script it creates the file then quits. Doesn't do anything past that.
Here is my code that I am using to attempt and run the python script. ( I am not and would not like to use IronPython ).
public void runPythonScript()
{
ProcessStartInfo startInfo = new ProcessStartInfo("python");
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.FileName = @"C:\Python27\python.exe";
startInfo.Arguments = @"C:\Users\bmahnke\Desktop\Python-Files\python3.py";
try
{
using (Process prog = Process.Start(startInfo))
{
prog.WaitForExit();
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}