title: Read continuous output from python subprocess.Popen which is executing a curses based application
body: <p>I have two programs, one curses based python application which outputs result periodically for 10 seconds. Second program is the driver application which runs this curses application, reads from the stdout and prints on screen. However I found that I don't get continuous output. Once the curses application terminates, I get all the data at once.</p>
  <pre><code>    proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
      print (&quot;\n started running&quot;)
      for line in proc.stdout:
          print(&quot;stdout = &quot; + line.decode())
  </code></pre>
  <p>So  &quot;for line in proc.stdout&quot; blocks till the subprocess finishes. This doesn't happen with application that doesn't use curses if i do &quot;sys.stdout.flush()&quot; from the app. But it has no effect in curses app. How can I get continuous output?</p>