my program is running well all the time but it suddenly stuck at Process.WaitForExit(); without proceeding to the next command. I have already ran the program multiple time without having error. Is anyone one know how can I debug this or is anyone know what is the problem behind? Could it be problem with my python.exe? Thanks!
public static void Process(string location)
{
int ExitCode;
ProcessStartInfo ProcessInfo;
Process Process;
ProcessInfo = new ProcessStartInfo();
ProcessInfo.FileName = location;
ProcessInfo.Arguments = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +
"\\parse.py " + Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\cache.cell";
ProcessInfo.CreateNoWindow = true;
ProcessInfo.UseShellExecute = false;
ProcessInfo.RedirectStandardOutput = true;
ProcessInfo.RedirectStandardError = true;
Process = Process.Start(ProcessInfo);
// (...)
Process.WaitForExit();
string stderr = Process.StandardError.ReadToEnd();
string stdout = Process.StandardOutput.ReadToEnd();
//Console.WriteLine("STDERR: " + stderr);
//Console.WriteLine("STDOUT: " + stdout);
using (System.IO.StreamWriter file = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\test.txt"))
{
file.WriteLine(stdout);
}