【发布时间】:2019-06-24 19:22:25
【问题描述】:
我编写了 python 脚本来运行 bash 脚本,它使用这一行运行它:
result = subprocess.Popen(['./test.sh %s %s %s' %(input_file, output_file, master_name)], shell = True)
if result != 0:
print("Sh*t hits the fan at some point")
return
else:
print("Moving further")
现在当 bash 脚本失败时我遇到了麻烦,python 不会继续做它正在做的事情,它只会结束。如何使 python 脚本在 bash 失败后继续运行?
【问题讨论】:
-
你试过
try/except