我有python脚本,它使用subprocess.run()
curl获取转储文件,mysql获取输入转储文件
cmd = "curl {0}/{1} -o /tmp/{2}".format(dir_name,file_name,file_name)
subprocess.run(cmd,shell=True)
cmd = "mysql -h main-rds.sfsadsafasdad.ap-northeast-1.rds.amazonaws.com -u admin -pXXXXXXXXXXXXXX mydbname < /tmp/{0}".format(file_name)
subprocess.run(cmd,shell=True)
print(cmd)目前,它运行良好,但没有任何错误处理。
如果mysql
curl失败,我将显示消息,并防止执行mysql失败,我想显示消息。这方面的最佳做法是什么?
发布于 2022-05-14 16:51:00
SqlCommand com = new SqlCommand("YourDBName", objconn.con);
com.CommandType = CommandType.StoredProcedure;
com.Parameters.AddWithValue("@ErrorID", 00);
com.Parameters.AddWithValue("@ErrorDiscription", "InValid");https://stackoverflow.com/questions/72242198
复制相似问题