execfile time out?

B

Brian Blais

Hello,


I'd like to do something like:

try:
execfile_timeout("somefile.py",5) # time out after 5 seconds
except TimeOutError:
print "this timed out!"


is there something that would do this? I'd like to call "somefile.py", but if it has
an infinite loop, I don't want to freeze at that point. If it helps, this part of
the code is already running in a thread, so I guess I could time-out the thread
rather than the execfile. Is there an easy way to do that?


thanks,

Brian Blais
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top