Does any one know if python has the ability to run a shutdown hook. For example you set a method to run when the python process is shutting down, like it recieved a kill signal? Basically looking for an effect like the following java code. Runtime.getRuntime().addShutdownHook(new Thread(this));