Python subprocess, mysqldump and pipes
问题 I've got a problem trying to build a easy backup/upgrade database script. The error is in the mysqldump call using subprocess: cmdL = ["mysqldump", "--user=" + db_user, "--password=" + db_pass, domaindb + "|", "gzip", ">", databases_path + "/" + domaindb + ".sql.gz"] print "%s: backup database %s \n\t[%s]" % (domain, domaindb, ' '.join(cmdL)) total_log.write("%s: backup database %s \n\t[%s] \n" % (domain, domaindb, ' '.join(cmdL))) p = subprocess.Popen(cmdL, stdout=subprocess.PIPE, stderr