Python脚本使用" time"来获取执行时间。

时间:2016-06-04 18:03:44

标签: python time

我需要我的脚本多次执行二进制文件,并使用" time"来获取有关其执行时间的一些统计信息。指示。但是,以下代码崩溃了:

cmd = ["time", "./executable", "<", "input_file"]
result = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.PIPE)

带有以下消息:

文件&#34; exec_script.py&#34;,第15行,in     result = subprocess.Popen(&#34; time ./quake&lt; small_input&#34;,stdout = subprocess.PIPE,stderr = subprocess.PIPE)   文件&#34; /usr/lib/python2.7/subprocess.py" ;,第710行, init     errread,errwrite)   文件&#34; /usr/lib/python2.7/subprocess.py",第1327行,在_execute_child中     提出child_exception OSError:[Errno 2]没有这样的文件或目录

我现在已经开了好几个小时了,无法解决这个问题,有什么帮助吗?请注意,如果我只是从同一目录运行该命令,它就可以工作。但不是通过剧本。

0 个答案:

没有答案
相关问题