Timed execution in eval

castironpi at gmail.com castironpi at gmail.com
Sat Mar 8 04:06:41 EST 2008


On Mar 7, 9:43 pm, George Sakkis <george.sak... at gmail.com> wrote:
> On Mar 7, 11:12 am, alex.pedwyso... at gmail.com wrote:
>
> > I have various bits of code I want to interpret and run at runtime in
> > eval ...
>
> Check out these two recipes:
>
> - Using signals:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871
>
> - Using threads:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/483752
>
> the second can't interrupt code that
> doesn't release the GIL and doesn't actually kill the function after
> the timeout.

Mine doesn't either, plus you need a C compiler.  I also learned today
that one of the import statements doesn't find the dll on Py <3.0.

Do you have a process kill ability?  That's another way to do it.



More information about the Python-list mailing list