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

Alex Martelli aleax at aleax.it
Fri Mar 28 10:47:24 EST 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.


Alex





More information about the Python-list mailing list