Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- timeout = 5
- sub = Thread(target = lambda: download("http://......."))
- sub.start()
- while sub.isAlive() and timeout > 0:
- sleep(1)
- timeout -= 1
- if sub.isAlive():
- raise Error[/code]
- The download(...) function wasn't written by me and it's infinitely blocking if it can't reach the destination so I'm trying to forcefully terminate it after 5 seconds.
- Why isn't this working? Python btw.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement