Error caused by previously installed module when importing

Hi everyone,

I've been trying to seperate my plonesite accoridng to this Converting single process Zope instance to ZEO cluster buildout.cfg — Plone Documentation v4.3 but get the following error when trying to import:

Error Value: No module named behavior.banner.browser.controlpanel

The log presents the following:

2018-11-06T10:18:11 ERROR txn.139874862622464 Error in tpc_abort() on manager <Connection at 7f3734ab4f50>
Traceback (most recent call last):
File "/data/plone_site/buildout-cache/eggs/transaction-2.1.2-py2.7.egg/transaction/_transaction.py", line 461, in _cleanup
rm.tpc_abort(self)
File "/data/plone_site/buildout-cache/eggs/ZODB-5.3.0-py2.7.egg/ZODB/Connection.py", line 631, in tpc_abort
transaction = transaction.data(self)
File "/data/plone_site/buildout-cache/eggs/transaction-2.1.2-py2.7.egg/transaction/_transaction.py", line 483, in data
raise KeyError(ob)
KeyError: <Connection at 7f3734ab4f50>

2018-11-06T10:18:11 ERROR Zope.SiteErrorLog 1541495891.310.746102829513 http://plonesite:8082/manage_importObject
Traceback (innermost last):
Module ZPublisher.Publish, line 138, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 48, in call_object
Module OFS.ObjectManager, line 626, in manage_importObject
Module OFS.ObjectManager, line 644, in _importObjectFromFile
Module ZODB.ExportImport, line 79, in importFile
Module ZODB.ExportImport, line 95, in importFile
Module transaction._transaction, line 228, in savepoint
Module transaction._transaction, line 344, in _saveAndRaiseCommitishError
Module transaction._transaction, line 225, in savepoint
Module transaction._transaction, line 713, in init
Module ZODB.Connection, line 1000, in savepoint
Module ZODB.Connection, line 518, in _commit
Module ZODB.ExportImport, line 183, in _importDuringCommit
ImportError: No module named behavior.banner.browser.controlpanel

It referes to a previously installed module (the one used as an example within the mastering plone training) which has been uninstalled and none of the site content adopts that behavior - from what I have been able to work out. Any pointers in the right direction would be appreciated.

Kind regards, Tony

Apparently, the import still contains an object referring to the no longer installed class (but this class might also be reference in the target ZODB). Likely, the deinstallation has been incomplete (potentially due to a hole in the deinstallation procedure).

The easiest thing would be to reinstall the missing package.

You might also have success with wildcard.fixpersistentregistries (so similarly named). This package overrides Zope's typical class factory and thereby can handle more missing class references in a ZODB. Note however, that this package is primarily for emercency fixups and may have unwanted side effects. This package likely will not help if the missing class is referenced from the import (rather than the target ZODB).

Hi Dieter, thank you for your answer!

Was more or less what I suspected - will try to just reinstall the package and see what happens I guess. Is there any reference documentation on what to take into consideration when uninstalling packages no longer in use for future reference?

Kind regards, Tony

Installation often (but not always) consists of two stages: providing the code (typically via buildout) and potentially installation in a portal (via quickinstaller or the Plone control panel). If your installation had these two stages, you must uninstall the extension from any portal you have installed it before you can remove the code. This is a necessary but not sufficient condition.

Uninstallation is far more complex than installation. The extension could have left artefacts at many places, following installations (of other extensions) may have changed the state and might partially depend on what was there when they have been installed. In addition, uninstallation is typically much less tested than installation. As a consequence, uninstallation often causes problems. If you install something for exploration purposes, do this in a throwaway installation, not in one you care about. Personally, I usually keep packages I no longer use around to avoid uninstallation problems (the cost is typically small).

1 Like

Hi Dieter,

Thank you for your detailed answer! A great help in wrapping your head around the process of installing and uninstalling of packages.

Kind regards, Tony.