Hi, I know this is old but maybe it will help someone. I used the following code and it worked as expected.
internal class Program
{
static void Main(string[] args)
{
ProcessStartInfo start = new ProcessStartInfo();
start.FileName = @"C:\Python27\python.exe";
start.Arguments = @"C:\Users\james\OneDrive\Desktop\ver1.py";
start.UseShellExecute = false;
start.CreateNoWindow = true;
start.RedirectStandardOutput = true;
string result = "";
using (Process process = Process.Start(start))
{
result = process.StandardOutput.ReadToEnd();
}
Console.WriteLine(result);
Console.ReadKey();
}
}
For the script I kept it really simple:
import sys
print(sys.version)
Saved as ver1.py to my desktop as you can see.
Result -- I got this in the console window:
2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)]
Good luck, never quit just keep coding!
JR