Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run example code in Usage #26

Closed
romanbo opened this issue Jun 19, 2016 · 1 comment
Closed

Unable to run example code in Usage #26

romanbo opened this issue Jun 19, 2016 · 1 comment

Comments

@romanbo
Copy link

romanbo commented Jun 19, 2016

I can't seem to get the example code working from your Usage section. Code:

`import time
import timeout_decorator

@timeout_decorator.timeout(5)

def mytest():
print "Start"
for i in range(1,10):
time.sleep(1)
print "%d seconds have passed" % i

if name == 'main':
mytest()
`
Error:

me$ python2.7 tod.py Start 1 seconds have passed 2 seconds have passed 3 seconds have passed 4 seconds have passed Traceback (most recent call last): File "tod.py", line 13, in <module> mytest() File "/Users/me/anaconda2/lib/python2.7/site-packages/timeout_decorator/timeout_decorator.py", line 69, in new_function return function(*args, **kwargs) File "tod.py", line 9, in mytest time.sleep(1) File "/Users/me/anaconda2/lib/python2.7/site-packages/timeout_decorator/timeout_decorator.py", line 60, in handler raise TimeoutError() timeout_decorator.timeout_decorator.TimeoutError: u'Timed Out'

@k2fong
Copy link
Contributor

k2fong commented Apr 14, 2017

looks like it works based on your output

@pnpnpn pnpnpn closed this as completed Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants