Possible Duplicate:
How do I execute a program from python? os.system fails due to spaces in path
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.
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()
In case this helps, if I have dos print out the exit code, it is -2. Thanks for any help.