First page Back Continue Last page Overview Graphics

Popen and the Command String

p = subprocess.Popen(['cp','-r', "xyz", "abc"])

is equal to the shell command

„cp -r xyz abc“

Blanks and shell Meta characters ($, > aso.) don't have to be escaped.

If you want to emulate the behaviour of os.system, you have to set shell=True and use a string instead of a list:

p=subprocess.Popen("cp -r xyz abc", shell=True)