[SciPy-User] [SciPy-user] signal handling inside integrate.odeint

Tom K. tpk at kraussfamily.org
Sun Aug 23 09:46:14 EDT 2009



Colin Cotter wrote:
> 
>   I have a question about handling signals with integrate.odeint. I am
> developing some Monte-Carlo code that involves repeated calls off this
> subroutine, but I seem to be doing something wrong with the signal
> handling because if I hit ctrl-c during runtime, the code just jumps
> out of odeint and continues with the loop. What is the best way to
> deal with this i.e. how do I modify the code so that if I hit ctrl-c
> during runtime the python script exits?
> 

I don't think you are doing anything wrong, except perhaps expecting a
different behavior.

It looks like odeint calls some FORTRAN routines (LSODA, STODA) that don't
have any error handling.  So, the C code wrapper that calls the python
function notices the error and prints a message (multipack.h, line 178) and
returns NULL, but the FORTRAN code just continues as if there's nothing
wrong.

I don't see a way to fix this without modifying the FORTRAN code.  Perhaps I
am wrong?

I was able to get back to the command line on my machine by causing an
interrupt within the interrupt (holding down control-c).
-- 
View this message in context: http://www.nabble.com/signal-handling-inside-integrate.odeint-tp25095497p25103457.html
Sent from the Scipy-User mailing list archive at Nabble.com.




More information about the SciPy-User mailing list