execfile time out?
Brian Blais
bblais at bryant.edu
Thu Feb 23 14:08:23 EST 2006
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
--
-----------------
bblais at bryant.edu
http://web.bryant.edu/~bblais
More information about the Python-list
mailing list