title: Python grep and pipe through Popen
body: <p>I'm trying to grep from a directory and limit the search to the first 100 results. The following code  keeps yielding</p>
  
  <pre><code>[..]
  grep: writing output: Broken pipe
  grep: writing output: Broken pipe
  grep: writing output: Broken pipe
  grep: writing output: Broken pipe
  [..]
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>p_grep = Popen(['/bin/bash', '-c', 'grep -F  "asdasdasd" data/*'], stdout = PIPE)
  p_head = Popen(['head', '-100'], stdin = p_grep.stdout, stdout = PIPE)
  output = p_head.communicate()[0]
  </code></pre>
  
  <p>How to fix it?</p>