exec code with timeout?

OKB (not okblacke) BrenBarn at aol.com
Mon Sep 8 13:29:28 EDT 2003


Paul Moore wrote:

>>>> import thread
>>>> import time
> 
>>>> def alarm(sec):
> ...     def wait(sec):
> ...         time.sleep(sec)
> ...         thread.interrupt_main()
> ...     thread.start_new_thread(wait, (sec,))

    	This looks perfect!  Many thanks.

-- 
--OKB (not okblacke)
"Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail."
	--author unknown




More information about the Python-list mailing list