output from popen

hiral hiralsmaillist at gmail.com
Mon Apr 5 10:03:52 CEST 2010


Hi,
I am trying following script...

<script>
import subprocess
cmd=['time', 'myCmd']
p = subprocess.Popen(cmd)
p.communicate()
<script>
Where 'myCmd' is some executable path and combination of arguments.

Now I am observing following output...
<myCmd_output...>
0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata
0maxresident)k
0inputs+0outputs (167major+23minor)pagefaults 0swaps

As you can observe output of 'time' command got printed as garbage.
Can you please let me know how can I get output of 'time' same as
terminal.

Thank you in advance.
-Hiral



More information about the Python-list mailing list