title: How to run external executable using Python?
body: <p>I have an external executable file which I am trying to run from a Python script. CMD executable runs but without generating output. Probably it exit before output can be generated. Any suggestion about how to delay exit until outputs are generated?</p>
  <pre><code>import subprocess, sys
  from subprocess import Popen, PIPE
  exe_str = r&quot;C:/Windows/System32/cmd C:/temp/calc.exe&quot;
  
  parent = subprocess.Popen(exe_str, stderr=subprocess.PIPE)
  </code></pre>