python打包后与c#窗体连接

          string debugPath = System.Environment.CurrentDirectory;           //此c#项目的debug文件夹路径
          string Path = debugPath + "\\DBSCAN.exe";

            Process p = new Process();
            p.StartInfo.FileName = Path;//需要执行的文件路径
            p.StartInfo.UseShellExecute = false; //必需
            p.StartInfo.RedirectStandardOutput = true;//输出参数设定
            p.StartInfo.RedirectStandardInput = true;//传入参数设定
            p.StartInfo.CreateNoWindow = true;
            //p.StartInfo.Arguments = "2 3";//参数以空格分隔,如果某个参数为空,可以传入””
            //p.StartInfo.Arguments = "'"+ textBox6.Text+"'";
            string a = textBox2.Text + " " + textBox3.Text + " " + textBox1.Text;
            p.StartInfo.Arguments = a;
            p.Start();
            string output = p.StandardOutput.ReadToEnd();
            p.WaitForExit();//关键,等待外部程序退出后才能往下执行
            if(output=="")
            {
                MessageBox.Show("出现错误!");
            }
           p.Close();

你可能感兴趣的:(C#,机器学习,数据挖掘)