title: 7zip Commands from Python
body: <p>There is a <a href="https://stackoverflow.com/questions/9128169/how-to-execute-7zip-commands-from-python-script">post</a> on this topic already, but it does not have an explicit answer to the fundamental question which I am re-asking here:</p>
  
  <p>How do you make 7zip commands from Python?</p>
  
  <p>Attempting to use the <a href="http://docs.python.org/library/subprocess.html#module-subprocess" rel="noreferrer">subprocess</a> module, I implemented the following which runs but does nothing (from what I can tell):</p>
  
  <pre><code>import subprocess
  cmd = ['7z', 'a', '"Test.7z"', '"Test"', '-mx9']
  subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
  </code></pre>
  
  <p>I know that the following 7zip command works, as I have tested on the Windows command line itself:</p>
  
  <pre><code>7z a "Test.7z" "Test" -mx9
  </code></pre>
  
  <p>How could I implement that simple 7zip command from Python?</p>