How to run a program in command line from python
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/204017/how-do-i-execute-a-program-from-python-os-system-fails-due-to-spaces-in-path">How do I execute a program from python? os.system fails due to spaces in path</a>  </p>
</blockquote>



<p>I am trying to call a program (MP3gain.exe) in command line from python. my problem is that python puts a [' '] around the command that I am sending to command line, and dos doesn't appear to be able to interpret the command with that. Here is my code.</p>

<pre><code>import os
import subprocess
import Editor

class normalize():
    def __init__(self, file):
        self.FileName = file

    def work(self):
        command = [ 'mp3gain /r /c' + self.FileName]
        subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)


if __name__ == "__main__":
    test = normalize("filename.mp3")
    test.work()
</code></pre>

<p>In case this helps, if I have dos print out the exit code, it is -2. Thanks for any help.</p>
