title: Python stderr and piping
body: <p>I searched a lot here and googled also, trying to find why stderr from my first command is not seen in the final stderr. I know of other methods like "check_output" (python3) and "commands" (python2), but I want to write my own cross-platform one. Here is the problem:</p>
  
  <pre><code>import subprocess
  
  p1 = subprocess.Popen('dirr', shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  p2 = subprocess.Popen('find "j"', shell=True, stdin=p1.stdout, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
  p1.stdout.close()
  output,error=p2.communicate()
  print(output,'&lt;-----&gt;',error)
  </code></pre>
  
  <p>I also tried redirecting stderr=subprocess.STDOUT, but this didn't change things.
  Can you please tell how to redirect the stderr from the first command, so I can see it in the stdout or stderr?</p>
  
  <p>Regards,</p>