Override default signal handler in interactive shell

pkassianidis at gmail.com pkassianidis at gmail.com
Mon Mar 27 04:02:14 EST 2006


Hello everybody,

I have written a python script which executes some functions and then
returns to the python interactive shell prompt (In other words I use
the command
"#!/usr/bin/python -i " in the script's header.
In this script I register my own handler for the SIGINT and SIGTERM
handlers but when I press Control-C the default handler is invoked and
the message "KeyboardInterrupt" is displayed. If I don't allow the
script to return control to the interactive shell, by putting for
example an endless loop, then  my handler works fine. Does anyone know,
how I can make it work in the first case also? Thank you very much.

         Best Regards

                Panos




More information about the Python-list mailing list