run python script from c 23

Solutions on MaxInterview for run python script from c 23 by the best coders in the world

showing results for - "run python script from c 23"
Francesca
21 Jul 2019
1using IronPython.Hosting;
2using Microsoft.Scripting.Hosting;
3
4private static void doPython()
5{
6    ScriptEngine engine = Python.CreateEngine();
7    engine.ExecuteFile(@"test.py");
8}
9
10//You can get IronPython here : https://ironpython.net/
Rock
21 Jul 2017
1private void run_cmd(string cmd, string args)
2{
3     ProcessStartInfo start = new ProcessStartInfo();
4     start.FileName = "my/full/path/to/python.exe";
5     start.Arguments = string.Format("{0} {1}", cmd, args);
6     start.UseShellExecute = false;
7     start.RedirectStandardOutput = true;
8     using(Process process = Process.Start(start))
9     {
10         using(StreamReader reader = process.StandardOutput)
11         {
12             string result = reader.ReadToEnd();
13             Console.Write(result);
14         }
15     }
16}
17
Juan Pablo
13 Aug 2016
1string strCmdText;
2string file;
3file = "py.py"
4strCmdText= "python3" + file;
5System.Diagnostics.Process.Start("CMD.exe",strCmdText);