title: Python: pass to subprocess a temporary generated file not as the last argument
body: <p>how to use subprocess if my temp-file argument is in the middle of the command? For example a terminal command looks like this:</p>
  
  <pre><code>program subprogram -a -b tmpFILE otherFILE
  </code></pre>
  
  <p>I tried variations of this:</p>
  
  <pre><code>from subprocess import Popen, PIPE
  from tempfile import SpooledTemporaryFile as tempfile
  tmpFILE=tempfile()
  tmpFILE.write(someList)
  tmpFILE.seek(0)
  print Popen(['program','subprogram', '-a', '-b', otherFile],stdout=PIPE,stdin=tmpFILE).stdout.read()
  f.close()
  </code></pre>
  
  <p>or</p>
  
  <pre><code>print Popen(['program','subprogram', '-a', '-b', tmpFILE, otherFile],stdout=PIPE,stdin=tmpFILE).stdout.read()
  </code></pre>
  
  <p>but nothing works... My temporary generated file in python shouldn't be as the last parameter.</p>
  
  <p>Thanks</p>