exec code with timeout?

OKB (not okblacke) BrenBarn at aol.com
Mon Sep 8 07:23:58 CEST 2003

Graham Fawcett wrote:

> The RestrictedPython module in Zope may suit your needs; it was
> designed for a
> similar use scenario. Search the list, there was a discussion about
> RestrictedPython not long ago.

    	Thanks.  I looked at the page that was referenced from here, but it 
says RestrictedPython "doesn't implement resource limitations, like 
preventing scripts from eating up all available RAM or simply never 
terminating".  Preventing scripts from never terminating is exactly what 
I am interested in.  (This isn't a halting problem kind of thing -- I 
just want to unceremoniously kill exec-ed code that doesn't terminate in 
a given amount of time.)  Also, it seems a bit heavyweight.  The page 
implies that it uses a modified compiler, etc.; I don't know how that 
would work with running interactively edited code.

--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