В linux у меня есть некоторые проблемы с обработкой Python на monodevelop C#
hi. i have some problem when i process python on monodevelop C#. at first , my program is launching on C# ( ubuntu Monodevelop ) and i want to process some python program ( by using bash ) it was done. i`ve succeed to process my python program by using 'Process' class but when i get result of Program line by line, there was some problem my python program give result line maybe once per a sec. but when i try 'ReadLine', it didn`t give me result once per a sec. it seems 60 line per 60sec. ( Read 60 Lines at once ) i need result everyseconds. whats wrong on my code or how can i get result every seconds?
<pre>using System; using System.Windows.Forms; using System.Drawing; using System.Diagnostics; public class monostart:Form { public static void Main() { Application.Run(new monostart()); } public monostart() { this.ClientSize = new Size(960, 540); BaseBoard(this); } public void BaseBoard(Form baseboard) { Button testgButton = new Button(); testgButton.Click += TestgButton_Click; testgButton.Height = 30; testgButton.Width = 30; testgButton.Location = new Point(300, 300); testgButton.Parent = Base; } void TestgButton_Click(object sender, EventArgs e) { Process proc = new Process(); proc.StartInfo.FileName = "/bin/bash"; proc.StartInfo.Arguments = "-c \"cd body25_2 && bash run_softmax.sh\""; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardOutput = true; proc.StartInfo.CreateNoWindow = false; proc.OutputDataReceived += new DataReceivedEventHandler(receive); proc.Start(); proc.BeginOutputReadLine(); proc.WaitForExit(); // while(!proc.StandardOutput.EndOfStream) // { // string temp = "text : "; // temp += proc.StandardOutput.ReadLine(); // Console.WriteLine(temp); // } } void receive(object e, DataReceivedEventArgs outLines) { System.Console.WriteLine("Line = " + outLines.Data); } }
Что я уже пробовал:
"пока" и "обработчик"
но все провалилось
моя программа python дает результат с помощью функции "print".
и я попробовал
печатать("~~~~");
print("~~~\n");
print("~~~\r\n");