dumping in destructor

Michele Simionato michele.simionato at gmail.com
Mon Oct 20 05:58:40 EDT 2008


On Oct 20, 10:12 am, Митя <neti... at gmail.com> wrote:
> But when g_register is being destroyed, dump seems to be already dead,
> so I get:
>
> Exception exceptions.TypeError: "'NoneType' object is not callable" in
> <bound method __Register.__del__ of <MyWiki.Register.__Register object
> at 0x835a74c>> ignored
>
> can I somehow save my data from destructor?

The best thing is to use the 'with' statement, but it requires you to
rewrite all
of your code. Alternatively you can use the atexit module. I wrote
once a
recipe that may be of interest to you:

http://code.activestate.com/recipes/523007/



More information about the Python-list mailing list