title: How to redirect apt-file update output
body: <p>I want access the output from the command <code>apt-file update</code> in a python script.
  Unfortunately, I am not able to access the output. My tries:</p>
  
  <pre><code># Does not work:
  popen_ret = subprocess.Popen([r'apt-file', 'update']), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  output = popen_ret.communicate()[0]
  print output
  
  # Without the "update" argument, it does work:
  popen_ret = subprocess.Popen([r'apt-file'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
  output = popen_ret.communicate()[0]
  print output
  </code></pre>
  
  <p>My guess is that the problemis with apt-file itself as, even directly from the console, this creates an empty file:</p>
  
  <pre><code>apt-file update &gt; delme.txt
  </code></pre>
  
  <p>Yet</p>
  
  <pre><code>apt-file &gt; delme.txt
  </code></pre>
  
  <p>works fine.</p>
  
  <p>Other peopele seem to have had the same problem (but no solution):
  <a href="http://www.linuxquestions.org/questions/programming-9/apt-file-output-redirection-to-file-945761/" rel="nofollow">question posed at http://www.linuxquestions.org</a></p>