How to run the following command using subprocess.Popen?
mysqldump database_name table_name | bzip2 > filename
I know os.system() can do the job but I dont want to wait for the dump to finish in main program.
How to run the following command using subprocess.Popen?
mysqldump database_name table_name | bzip2 > filename
I know os.system() can do the job but I dont want to wait for the dump to finish in main program.
You want the shell=True option to make it execute shell commands:
import subprocess
subprocess.Popen("sleep 4s && echo right thar, right thar",shell=True);
print 'i like it when you put it'
which yeilds:
I like it when you put it
[4 seconds later]
right thar, right thar