It is really a smart idea to catch and re-raise KeyboardInterrupts, to be able to continue to get rid of This system using Ctrl-C. Logging is outside the house the scope from the concern, but a superb choice is logging. Documentation for that sys and traceback modules. The Lifeline method https://simontyelp.gynoblog.com/36064238/the-smart-trick-of-free-government-phone-that-nobody-is-discussing