python shutdown hook method UPDATE

I think using atexit module - is cleaner

Lawrence -
"Anyone can freely use whatever he wants but the light at the end
of the tunnel for most of his problems is Python"

5. Duncan Booth
Nov 16, 3:48 am show options
Newsgroups: comp.lang.python
From: Duncan Booth - Find messages by this author
Date: 16 Nov 2005 08:48:15 GMT
Local: Wed, Nov 16 2005 3:48 am
Subject: Re: Shutdown hook

Lawrence Oluyede wrote:

Correct, although this won't catch all cases where a program is exiting.
For example, on Windows, if you use Ctrl+C to terminate a program the
atexit function *is* called, but if you use Ctrl+Break the atexit function
is not called unless you install a suitable signal handler:

import signal
def sigbreak(signum, frame):

signal.signal(signal.SIGBREAK, sigbreak)

Even then there are still other ways to terminate a process which will not


Popular posts from this blog

Vim vi how to reload a file your editing