title: process.stdout.readline() hangs. How to use it properly?
body: <p>I want to repeatedly send requests to process standard input and receive responses from standard output <strong><em>without</em></strong> calling <code>subprocess</code> multiple times. I can achieve a one-time request-response iteration using <code>p.communicate</code> however not to call the <code>subprocess</code> multiple times I need to use: <code>process.stdout.readline()</code> which hangs. How to use it properly?
  I use Python 2.7 64 bit, Windows 7. Thanks in advance.</p>
  
  <p><strong><code>main.py</code></strong>:</p>
  
  <pre><code>import subprocess
  p = subprocess.Popen(['python','subproc.py'],stdin=subprocess.PIPE,stdout=subprocess.PIPE)
  
  while True:
      s=raw_input('Enter message:')
      p.stdin.write(s)
      p.stdin.flush()
      response = p.stdout.readline()
      if response!= '':
          print "Process response:", response
      else:
          break
  </code></pre>
  
  <p><strong><code>subproc.py</code></strong>:</p>
  
  <pre><code>from __future__ import division
  import pyximport
  s=raw_input()
  print 'Input=',s
  </code></pre>