我在一個winform的c#程序里通過process調用python程序,這個python程序里有多線程?,F在問題是我調用的python程序可以跑,但是跑一會就不能運行了,但是我如果單獨運行python就沒有問題,這是為什么。ic void RunPythonScript(string path, string args = "")
{
path = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "script\\" + path;
p.StartInfo.FileName = "python.exe"; string sArguments = "\"" + path + "\"";
if (args.Length > 0)
{
sArguments += " " + args;
}
//p.StartInfo.WorkingDirectory = "D:\\";
p.StartInfo.Arguments = sArguments;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
//p.CloseMainWindow();
//p.WaitForExit();
}`
- 1 回答
- 0 關注
- 146 瀏覽
添加回答
舉報
0/150
提交
取消