title: python get output of grep -q from subprocess
body: <p>I'm trying to run greq -q in python, but it does not work.
  First I figured out i need to <code>.decode()</code> the string.
  But then I noticed I get empty output everytime even if the grep command does match.</p>
  <p>Code:</p>
  <pre><code>from subprocess import Popen, PIPE
  import os
  
  process1 = Popen(&quot;grep -q string file.txt&quot;,shell=True,stdout=PIPE)
  stdout1,stderr1 = process1.communicate()
  if stdout1.decode() == &quot;&quot;:
      print(&quot;not found&quot;)
  else:
      print(&quot;found&quot;)
  </code></pre>
  <p>What am I doing wrong?</p>