I use Python3, Ubuntu 14.04 to run the following snippet. The timing() function never terminate. I suppose it is due to the Timer() function. Why? How can I fix it?
import subprocess
def timing():
    args = ("./a.out")
    print('start')
    popen = subprocess.Popen(args, stdout=subprocess.PIPE)
    popen.wait()    
    print('end')
if __name__ == '__main__':
    import timeit
    print('main')
    t=timeit.Timer("timing()","from __main__ import timing")
    print(t.timeit())
In the terminal, it shows:
main
start
end
start
end
start
...
The skeleton of the code is from this answer.
 
     
    