Subprocess.Call fails "The System Cannot Find the File Specified"

python

Solution

Specify program and its arguments as list:

p = subprocess.Popen([
    "C:/Flow Check/Run Quick/Applications/Manipula.exe",
    "C:/Flow Check/Data Processing/BLAISE TO BLAISE.msu"],
    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

Writing string literals serially merges the strings:

>>> "abc" "xyz"
'abcxyz'

Problem

I have a .exe file called Manipula that takes as its source a .msu file. I can successfully run what I want through the command line like so: ``` "C:/Flow Check/Run Quick/Applications/Manipula.exe" "C:/Flow Check/Data Processing/BLAISE TO BLAISE.msu" ``` However, I cannot simulate this behavior in Python-- no matter what I use. I have tried `os.system` and `subprocess.call` and `subprocess.Popen` If I run something like the following ``` p= subprocess.Popen("C:/Flow Check/Run Quick/Applications/Manipula.exe" "C:/Flow Check/Data Processing/BLAISE TO BLAISE.msu", stdout=subprocess.PIPE, stderr=subprocess.STDOUT) for line in p.stdout.readlines(): print line, retval = p.wait() ``` I get an error: `The System Cannot Find the File Specified.` I've triple-checked, the file is clearly there because it works when I run the commandline. When I add `shell=True` to subprocess.Popen a new error appears that there is no directory `C:/Flow`, I think because the shell has a hard time processing spaces... I just don't know what's going on. When I do `os.system("C:/Flow Check/Run Quick/Applications/Manipula.exe" "C:/Flow Check/Data Processing/BLAISE TO BLAISE.msu")` nothing happens. Any ideas?

Original source