Again, how to write a cleanup function for a module in C

Alex Martelli aleax at
Fri Mar 28 16:47:24 CET 2003

Lexy Zhitenev wrote:

> I posted this message a week ago, but didn't get the solution.
> I have to do some cleanup when my program exits. It is not global cleanup.
> It cannot be done in sys.exitfunc. It is local, I have to manage it in my
> module, like closing a connection to the database on exit after connecting
> on import.

See standard Python library module atexit.


More information about the Python-list mailing list