title: Running a command line from python and piping arguments from memory
body: <p>I was wondering if there was a way to run a command line executable in python, but pass it the argument values from memory, without having to write the memory data into a temporary file on disk. From what I have seen, it seems to that the subprocess.Popen(args) is the preferred way to run programs from inside python scripts.</p>
  
  <p>For example, I have a pdf file in memory. I want to convert it to text using the commandline function pdftotext which is present in most linux distros. But I would prefer not to write the in-memory pdf file to a temporary file on disk.</p>
  
  <pre><code>pdfInMemory = myPdfReader.read()
  convertedText = subprocess.&lt;method&gt;(['pdftotext', ??]) &lt;- what is the value of ??
  </code></pre>
  
  <p>what is the method I should call and how should I pipe in memory data into its first input and pipe its output back to another variable in memory?</p>
  
  <p>I am guessing there are other pdf modules that can do the conversion in memory and information about those modules would be helpful. But for future reference, I am also interested about how to pipe input and output to the commandline from inside python.</p>
  
  <p>Any help would be much appreciated.</p>