Sunday, 11 August 2013

how to raise a timeout exception after X seconds in python

how to raise a timeout exception after X seconds in python

I have a function and I need to raise exception after X seconds how can I
do this? I try this code but It doesen't work:
from eventlet.timeout import Timeout
timeout = Timeout(seconds, exception)
try:
do somethins
finally:
timeout.cancel()

No comments:

Post a Comment