I am trying to write a script, and one of the things that I want it to do is call the command line version of MP3Gain and pass it the file I am working with for MP3Gain to normalize the volume. Here is my code:
import subprocess
class normalize():
def __init__(self, file):
self.FileName = file
def work(self):
command = [r"mp3gain.exe", "-r", r"-c ", self.FileName]
subprocess.Popen(command,shell=True,stdout=subprocess.PIPE)
if __name__ == "__main__":
test = normalize(r"C:\Users\CPC\Desktop\2013-01-20.mp3")
test.work()
If I use this same code and open a different program, it works fine. If I have the program send the "command" variable to a text file, and then type in what is in the text file as a command in cmd, it also works fine. So it seems like there is some kind of interference between the python subprocess module and MP3Gain. Does anybody have an experience with this? Is there some other way to accomplish the same thing? Any help would be appreciated.