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

How would I stop a while loop after n amount of time? #27

Open
kif1205 opened this issue May 19, 2019 · 1 comment
Open

How would I stop a while loop after n amount of time? #27

kif1205 opened this issue May 19, 2019 · 1 comment

Comments

@kif1205
Copy link
Owner

kif1205 commented May 19, 2019

https://stackoverflow.com/questions/13293269/how-would-i-stop-a-while-loop-after-n-amount-of-time

from interruptingcow import timeout
try:
with timeout(60*5, exception=RuntimeError):
while True:
test = 0
if test == 5:
break
test = test - 1
except RuntimeError:
pass

@kif1205
Copy link
Owner Author

kif1205 commented May 19, 2019

This way only works in linux , not working in Windows

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

1 participant