func_timeout.dafunc
index

 
Modules
       
threading
time

 
Functions
       
func_timeout(timeout, func, args=(), kwargs=None)
func_timeout - Runs the given function for up to #timeout# seconds.
 
Raises any exceptions #func# would raise, returns what #func# would return (unless timeout is exceeded), in which case it raises FunctionTimedOut
 
@param timeout <float> - Maximum number of seconds to run #func# before terminating
@param func <function> - The function to call
@param args    <tuple> - Any ordered arguments to pass to the function
@param kwargs  <dict/None> - Keyword arguments to pass to the function.
 
@raises - FunctionTimedOut if #timeout# is exceeded, otherwise anything #func# could raise will be raised
 
@return - The return value that #func# gives