【发布时间】:2015-10-30 09:56:52
【问题描述】:
以下代码在 Python 中无法正常工作。问题是输出没有通过使用>重定向到output:
command = toolpath + " " + query + " " + number + " > " + output;
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE);
output = process.communicate()[0];
如果打印出来,命令其实如下:
./subsetA.pl ./remainingqueries.fasta 100 > ./tmpQuery.fasta
因此,perl 脚本subsetA.pl 接受两个参数并将其写入stdout,然后重定向到tmpQuery.fasta。但调用命令后tmpQuery.fasta 为空。
如果我直接在 CLI 上运行它,那么它可以完美运行。
【问题讨论】:
-
你在 Popen 中用
shell=True试过了吗? -
现在 perl 脚本没有得到参数 :-(
-
啊,是的,你不需要拆分了
-
等瞧...谢谢!就是这样