title: Interact with a Windows console application via Python
body: <p>I am using python 2.5 on Windows. I wish to interact with a console process via Popen. I currently have this small snippet of code:</p>
  
  <pre><code>p = Popen( ["console_app.exe"], stdin=PIPE, stdout=PIPE )
  # issue command 1...
  p.stdin.write( 'command1\n' )
  result1 = p.stdout.read() # &lt;---- we never return here
  # issue command 2...
  p.stdin.write( 'command2\n' )
  result2 = p.stdout.read()
  </code></pre>
  
  <p>I can write to stdin but can not read from stdout. Have I missed a step? I don't want to use p.communicate( "command" )[0] as it terminates the process and I need to interact with the process dynamically over time.</p>
  
  <p>Thanks in advance.</p>