i creating file , doing diff on it.
i want diff on file iscreated in previous step error file dont exist .
this code
os.popen("mysqldump --login-path=server1_mysql -e --opt --skip-lock-tables --skip-extended-insert -c %s > %s.sql" % (database, filename)) os.popen("diff %s %s > %s" % (weekly, filename, filename+".patch"))
os.popen()
has been deprecated since version 2.6. however, code working, should wait first process finish (and output file created) before starting second.
the exit status of first command available return value of close()
method of file object returned, can check before continuing, i.e.:
pipe = os.popen("mysqldump --login-path=server1_mysql -e --opt " "--skip-lock-tables --skip-extended-insert -c %s > %s.sql" % (database, filename)) if pipe.close() none: # no errors? os.popen("diff %s %s > %s" % (weekly, filename, filename+".patch"))
Comments
Post a Comment