title: writing large amount of data to stdin
body: <p>I am writing a large amount of data to stdin. </p>
  
  <p>How do i ensure that it is not blocking? </p>
  
  <pre><code>p=subprocess.Popen([path],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
  p.stdin.write('A very very very large amount of data')
  p.stdin.flush()
  output = p.stdout.readline()
  </code></pre>
  
  <p>It seems to hang at <code>p.stdin.write()</code> after i read a large string and write to it.</p>
  
  <p>I have a large corpus of files which will be written to stdin sequentially(>1k files)</p>
  
  <p>So what happens is that i am running a loop</p>
  
  <pre><code>#this loop is repeated for all the files
  for stri in lines:
  p=subprocess.Popen([path],stdout=subprocess.PIPE,stdin=subprocess.PIPE)
  p.stdin.write(stri)
  output = p.stdout.readline()
  #do some processing
  </code></pre>
  
  <p>It somehow hangs at file no. 400. The file is a large file with long strings. </p>
  
  <p>I do suspect its a blocking issue.</p>
  
  <p>This only happens if i iterate from 0 to 1000. However, if i were to start from file 400, the error would not happen</p>