thank you chris,
I thought about something like that but I could not "catch" this 'NO
DATA etc'.

On 19 juil, 17:51, chris wuthrich <[email protected]>
wrote:
> > > A related question: is it possible to catch an exception if there is a
> > > time out?
>
> I think there should be. The timeout process should raise an exception
> which can be catch. Right now, one can catch that it sends back a
> string 'NO DATA (timed out)' rather than a result. So the following
> should do. But that is not the way it should be IMHO.
>
> @fork(timeout=1)
> def mon_factor(n):
>     return factor(n)
>
> for m in [randint(10,100) for i in [1..10]]:
>     N = 10^m +127
>     ff = mon_factor(N)
>     if type(ff) != type('a'):
>         print "success : %s"%ff
>     else:
>         print "no success : %s"%ff
>
> Chris.

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to