如何等待python脚本运行命令完成?

问题描述

我想在工具(Calibre)运行完成后收集工具(Calibre)的结果。 为了节省时间,我在Linux中使用'&'命令在后台运行工具。 但是,我等不及要运行工具完成。

subprocs = []
for i in range(5):
    drcruncmd = ["/sw/bin/lsf_calibre -I -- -drc -hier -turbo 16 -hyper 16 " + drcrulePath + " | tee " + dirPath + "/drc" + str(i) + ".log &"]
    subproc = subprocess.Popen(drcruncmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
    subprocs.append(subproc)
    
for p in subprocs:
    p.wait()
    
print "Running Calibre is complete"

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)