相关疑难解决方法(0)

为什么python不再等待os.system完成?

我有以下功能,几个月来一直很好用.我没有更新我的Python版本(除非它发生在幕后?).

def Blast(type, protein_sequence, start, end, genomic_sequence):
    result = []
    M = re.search('M', protein_sequence)
    if M:
        query = protein_sequence[M.start():]
        temp = open("temp.ORF", "w")
        print >>temp, '>blasting'
        print >>temp, query
        temp.close()
        cline = blastp(query="'temp.ORF'", db="DB.blast.txt",
                       evalue=0.01, outfmt=5, out=type + ".BLAST")
        os.system(str(cline))
        blast_out = open(type + ".BLAST")
        string = str(blast_out.read())
        DEF = re.search("<Hit_def>((E|L)\d)</Hit_def>", string)
Run Code Online (Sandbox Code Playgroud)

我收到blast_out=open(type+".BLAST")无法找到指定文件的错误.此文件作为os.system调用调用的程序输出的一部分创建.这通常需要大约30秒才能完成.但是,当我尝试运行程序时,它立即给出了我上面提到的错误.

我以为os.system()应该等待完成?
我应该以某种方式强迫等待吗?(我不想硬编码等待时间).

编辑:我已经在BLAST程序的命令行版本中运行了cline输出.一切似乎都很好.

python os.system

7
推荐指数
2
解决办法
3万
查看次数

标签 统计

os.system ×1

python ×1