> > while 1: > runner = os.popen("tracert -d www.hello.com") > o=runner.read() > print(o) > runner.close() > runner = os.popen("tracert -d www.hello.com") > o=runner.read() > print(o) > runner.close() > runner = os.popen("tracert -d www.hello.com") > o=runner.read() > print(o) > runner.close() > > > after running over 1 hour, it stop and not return in one of tracert > > how to set timeout and know that this is timeout? >
There are a number of answers on Stackoverflow, for example https://stackoverflow.com/questions/492519/timeout-on-a-function-call. The first few answers there seem to be Nix-specific, with OS-agnostic multiprocessing answers below. -- https://mail.python.org/mailman/listinfo/python-list