title: Command prompt launches when using process in C# to run Python script with argument and receive output to C#
body: <p>Im trying to pass an argument from C# to a Python script and then read the output from that Python script in C# by using the Process class. I have read on other threads about doing this and almost solved it. My problem is that it launches Python in the command prompt and then asks for an argument, which I have already included when I passed the command the first time to the command prompt. I'm using this in Visual Studio with C# and WPF .NET, it runs this C# program on every change in the textbox. I want it to run my script with every key press basically, to update the output with every new character. The script (in the code) gives an output directly if I pass it directly to the command prompt, but not when using the code to run the script.</p>
  <p>I have tried setting start.CreateNoWindow = True, but that just makes the command prompt invisible, still asking for an argument.</p>
  <p>Also, if anyone knows any better way to send and receive stuff between C# and Python, I'd be glad to hear it. I have never combined C# and Python together before :)</p>
  <pre><code>internal class PyParserV2
  {
  
      public string readWrite(string input)
      {
          string result;
  
          ProcessStartInfo start = new ProcessStartInfo(@&quot;python.exe&quot;);
  
          string script = &quot;../makepred.py&quot;;
  
          start.Arguments = string.Format(&quot;{0} {1}&quot;, script, input);
          Console.WriteLine(string.Format(&quot;{0} {1}&quot;, script, input));
          start.UseShellExecute = false;
          start.RedirectStandardOutput = true;
          start.RedirectStandardError = true;
          start.CreateNoWindow = false;
  
          
          using (Process process = Process.Start(start))
          {
              using (StreamReader reader = process.StandardOutput)
              {
                  result = reader.ReadToEnd();
                  Console.WriteLine(&quot;Output prediction: &quot; + result);
              }
          }
  
          Console.Read();
          return result;
  
      }
  }
  </code></pre>
  <p>Image:
  <a href="https://i.stack.imgur.com/FUmb3.png" rel="nofollow noreferrer">This is what happens everytime I type in the textbox</a></p>