-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunPython.cs
53 lines (48 loc) · 1.79 KB
/
RunPython.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Diagnostics;
using System.IO;
namespace ConsoleApplication
{
public static class RunPython
{
public static void Run(string delta, string building)
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = "python.exe";
string pyscript = "scrape_script.py";
string args = building + " " + delta;
start.Arguments = string.Format("{0} {1}", pyscript, args);
// start.UseShellExecute = false;
// start.RedirectStandardOutput = true;
// start.RedirectStandardError = true;
// start.CreateNoWindow = false;
// start.WindowStyle = ProcessWindowStyle.Hidden;
Process pyprocess = new Process();
pyprocess.StartInfo = start;
pyprocess.Start();
// try
// {
// StreamReader outputReader = pyprocess.StandardOutput;
// StreamReader errReader = pyprocess.StandardError;
//
// string csvfilename = null;
// while (!pyprocess.HasExited && csvfilename == null && !outputReader.EndOfStream)
// {
// while (outputReader.Peek() >= 0 && outputReader.ReadLine() != null)
// {
// csvfilename = outputReader.ReadLine();
// Console.WriteLine("This should not print");
// }
//
//// Console.WriteLine(outputReader.ReadLine());
// Console.WriteLine(errReader.ReadToEnd());
// }
// Console.WriteLine("This should print");
// }
// catch(Exception ex)
// {
// Console.WriteLine(ex.StackTrace);
// }
}
}
}