Re: how to set timeout for os.popen

2018-04-16 Thread eryk sun
On Mon, Apr 16, 2018 at 1:33 PM, Jugurtha Hadjar wrote: > On 04/15/2018 12:01 PM, Ho Yeung Lee wrote: >> >> while 1: >> runner = os.popen("tracert -d www.hello.com") >> o=runner.read() >> >> how to set timeout and know that this is timeout? > > @contextmanager > def

Re: how to set timeout for os.popen

2018-04-16 Thread Jugurtha Hadjar
On 04/15/2018 12:01 PM, Ho Yeung Lee wrote: 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)

Re: how to set timeout for os.popen

2018-04-15 Thread Jason Friedman
> > 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() > >

Re: how to set timeout for os.popen

2018-04-15 Thread MRAB
On 2018-04-15 12:01, Ho Yeung Lee wrote: 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)