& is a shell function. If you want it to work with subprocess , you must specify shell=True as:
subprocess.call(command, shell=True)
This will allow you to execute the command in the background.
Notes:
Since shell=True , the above example uses command , not command_list .
Using shell=True allows you to use all the shell functions. Do not do this if command including thingy does not come from sources you trust.
Safer alternative
This alternative still allows you to run the command in the background, but it is safe because it uses shell=False by default:
p = subprocess.Popen(command_list)
After executing this statement, the command will be launched in the background. If you want to be sure that it is complete, run p.wait() .
source share