try/except KeyboardInterrupt vs signal handler for SIGINT

Rafael Durán Castañeda rafadurancastaneda at gmail.com
Mon May 7 17:59:30 EDT 2012


Hi,

I was wondering which approach is better to stop several servers from 
just on python application when 'ctrl-c' is pressed, a try/except 
KeyboardInterrupt or just registering a SIGINT handler and exit when the 
signal is triggered. Any advantage/disadvantage from one approach over 
the other?

P.S.: Since several servers are started just one 'ctrl-c' doesn't work 
without any extra change and I have some concerns about the signal handler.

Thank you for your answers.



More information about the Python-list mailing list