[ZODB-Dev] ZODB file never updated - import transaction fails...
Dieter Maurer
dieter at handshake.de
Sat Jul 29 16:06:10 EDT 2006
skip at pobox.com wrote at 2006-7-29 08:40 -0500:
> ...
>When the cache is deleted, its __del__ method calls
>
> self.close()
>
>which calls self._zodb_close():
>
> def _zodb_close(self):
> # Ensure that the db is saved before closing. Alternatively, we
> # could abort any waiting transaction. We need to do *something*
> # with it, though, or it will be still around after the db is
> # closed and cause problems. For now, saving seems to make sense
> # (and we can always add abort methods if they are ever needed).
> self._zodb_store()
>
> # Do the closing.
> self._DB.close()
>
>which calls self._zodb_store():
>
> def _zodb_store(self):
> import transaction
> ...
>which seems to fail. I get this message in the log:
>
> Exception exceptions.ImportError: 'No module named transaction' in
> <bound method cache.__del__ of <spambayes.dnscache.cache instance at
> 0x11994b8>> ignored
Is the cache deleted when Python terminates?
At this time, Python no longer works reliable as resources
must be released in some order and after a resource is released
it cannot be used anymore. In your case, "sys.path" might have
been released when the destructor tries to import "transaction".
It will fail then.
Avoid using "__del__" and call your close explicitely.
--
Dieter
More information about the ZODB-Dev
mailing list