When passing the command as a list, subprocess.Popen will automatically quote arguments that have spaces. However, if I running java with a system property that has spaces like this:
-Dwebdriver.firefox.bin="C:\Program Files (x86)\Mozilla Developer Preview\firefox.exe"
, it will give an error: 'C:\Program' is not recognized error , which I believe is because Popen would insert quotes around the entire argument if it sees a space, and escapes the rest of the double quotes. I'm not sure how I can fix this if I want to keep using the Popen command:
subprocess.Popen([
'cmd.exe', '/C', 'C:\\Program Files\\java\\jre7\\bin\\java.exe',
'-Dwebdriver.firefox.bin="C:\\Program Files (x86)\\Mozilla Developer Preview\\firefox.exe"',
'-jar', 'C:\\Users\\testing\\Temp\\SeleniumServer.jar'])