[SOLVED] ImportError IPossibleSite under Plone 5.2/Python 3

Currently porting a simple add-on from Plone 5.1 to 5.2 and getting this error:

Any idea?


/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Products.CMFUid-3.0.1-py3.7.egg/Products/CMFUid/UniqueIdHandlerTool.py:24: DeprecationWarning: InitializeClass is deprecated. Please import from AccessControl.class_init.
  from App.class_init import InitializeClass
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Products.CMFEditions-3.3.2-py3.7.egg/Products/CMFEditions/StandardModifiers.py:46: DeprecationWarning: ComponentLookupError is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import ComponentLookupError
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Products.CMFFormController-4.1.0-py3.7.egg/Products/CMFFormController/ControllerPythonScript.py:41: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp
2019-11-18 13:25:35,410 WARNING [Init:89][MainThread] Class Products.CMFFormController.ControllerPythonScript.ControllerPythonScript has a security declaration for nonexistent method 'ZPythonScriptHTML_changePrefs'
2019-11-18 13:25:35,418 WARNING [Init:89][MainThread] Class Products.CMFFormController.ControllerValidator.ControllerValidator has a security declaration for nonexistent method 'ZPythonScriptHTML_changePrefs'
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Products.CMFPlacefulWorkflow-2.0.0-py3.7.egg/Products/CMFPlacefulWorkflow/permissions.py:5: DeprecationWarning: setDefaultRoles is deprecated. Please use addPermission from AccessControl.Permission.
  from Products.CMFCore.permissions import setDefaultRoles
2019-11-18 13:25:35,848 INFO    [ZEO.ClientStorage:209][MainThread] zeostorage ClientStorage (pid=7596) created RW/normal for storage: '1'
2019-11-18 13:25:35,849 INFO    [ZEO.cache:208][MainThread] created temporary cache file 6
2019-11-18 13:25:35,853 INFO    [ZEO.asyncio.base:51][zeostorage zeo client networking thread] Connected Protocol(('127.0.0.1', 5200), '1', False)
2019-11-18 13:25:35,862 INFO    [ZEO.ClientStorage:366][zeostorage zeo client networking thread] zeostorage Connected to storage: ('localhost', 5200)
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/plone.api-1.10.0-py3.7.egg/plone/api/validation.py:15: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  signature_args, _, _, _ = inspect.getargspec(func)
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Products.CMFPlone-5.2.0-py3.7.egg/Products/CMFPlone/browser/contact_info.py:15: DeprecationWarning: zope.site.hooks has moved to zope.component.hooks. Import of zope.site.hooks will become unsupported in Version 5.0
  from zope.site.hooks import getSite
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/plone.scale-3.0.3-py3.7.egg/plone/scale/storage.py:5: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import MutableMapping
/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/grokcore.site-3.0.3-py3.7.egg/grokcore/site/interfaces.py:16: DeprecationWarning: IObjectEvent is deprecated. Import from zope.interface.interfaces
  from zope.component.interfaces import IObjectEvent
Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 240, in resolve
    obj = getattr(mod, oname)
AttributeError: module 'five' has no attribute 'grok'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 391, in endElementNS
    self.context.end()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 703, in end
    self.stack.pop().finish()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 867, in finish
    args = toargs(context, *self.argdata)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 1686, in toargs
    args[str(name)] = field.fromUnicode(s)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/fields.py", line 171, in fromUnicode
    value = self.context.resolve(name)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 246, in resolve
    __import__(moname)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/five.grok-1.3.2-py3.7.egg/five/grok/__init__.py", line 22, in <module>
    from five.grok.components import Model, Container, Site, LocalUtility
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/five.grok-1.3.2-py3.7.egg/five/grok/components.py", line 21, in <module>
    from zope.location.interfaces import IPossibleSite
ImportError: cannot import name 'IPossibleSite' from 'zope.location.interfaces' (/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.location-4.2-py3.7.egg/zope/location/interfaces.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/parts/instance/bin/interpreter", line 297, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/serve.py", line 252, in <module>
    sys.exit(main() or 0)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/serve.py", line 248, in main
    return command.run()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/serve.py", line 189, in run
    global_conf=vars)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/serve.py", line 217, in loadapp
    return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/loadwsgi.py", line 253, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/loadwsgi.py", line 278, in loadobj
    return context.create()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/loadwsgi.py", line 715, in create
    return self.object_type.invoke(self)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/loadwsgi.py", line 209, in invoke
    app = context.app_context.create()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/loadwsgi.py", line 715, in create
    return self.object_type.invoke(self)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/loadwsgi.py", line 152, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/PasteDeploy-2.0.1-py3.7.egg/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/run.py", line 71, in make_wsgi_app
    starter.prepare()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/starter.py", line 41, in prepare
    self.startZope()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/Startup/starter.py", line 98, in startZope
    Zope2.startup_wsgi()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/__init__.py", line 50, in startup_wsgi
    _startup()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/App/startup.py", line 143, in startup
    load_zcml()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/App/startup.py", line 58, in load_zcml
    load_site()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/Zope2/App/zcml.py", line 45, in load_site
    _context = xmlconfig.file(site_zcml)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 657, in file
    include(context, name, package)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 557, in include
    processxmlfile(f, context)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 407, in processxmlfile
    parser.parse(src)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python3.7/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 469, in EndElement
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 381, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 393, in endElementNS
    self._handle_exception(ex, info)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 391, in endElementNS
    self.context.end()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 703, in end
    self.stack.pop().finish()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 868, in finish
    actions = self.handler(context, **args)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Zope-4.1.1-py3.7.egg/OFS/metaconfigure.py", line 47, in loadProducts
    xmlconfig.include(_context, zcml, package=product)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 557, in include
    processxmlfile(f, context)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 407, in processxmlfile
    parser.parse(src)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python3.7/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 469, in EndElement
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 381, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 393, in endElementNS
    self._handle_exception(ex, info)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 391, in endElementNS
    self.context.end()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 703, in end
    self.stack.pop().finish()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 868, in finish
    actions = self.handler(context, **args)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/z3c.autoinclude-0.3.9-py3.7.egg/z3c/autoinclude/zcml.py", line 104, in includePluginsDirective
    includeZCMLGroup(_context, info, filename)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/z3c.autoinclude-0.3.9-py3.7.egg/z3c/autoinclude/zcml.py", line 30, in includeZCMLGroup
    include(_context, filename, includable_package)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 557, in include
    processxmlfile(f, context)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 407, in processxmlfile
    parser.parse(src)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python3.7/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 469, in EndElement
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 381, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 393, in endElementNS
    self._handle_exception(ex, info)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 391, in endElementNS
    self.context.end()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 703, in end
    self.stack.pop().finish()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 868, in finish
    actions = self.handler(context, **args)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 557, in include
    processxmlfile(f, context)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 407, in processxmlfile
    parser.parse(src)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 111, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python3.7/xml/sax/xmlreader.py", line 125, in parse
    self.feed(buffer)
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 217, in feed
    self._parser.Parse(data, isFinal)
  File "../Modules/pyexpat.c", line 469, in EndElement
  File "/usr/lib/python3.7/xml/sax/expatreader.py", line 381, in end_element_ns
    self._cont_handler.endElementNS(pair, None)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 393, in endElementNS
    self._handle_exception(ex, info)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 235, in _handle_exception
    reraise(exc, None, sys.exc_info()[2])
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/_compat.py", line 30, in reraise
    raise value.with_traceback(tb)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/xmlconfig.py", line 391, in endElementNS
    self.context.end()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 703, in end
    self.stack.pop().finish()
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 867, in finish
    args = toargs(context, *self.argdata)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 1686, in toargs
    args[str(name)] = field.fromUnicode(s)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/fields.py", line 171, in fromUnicode
    value = self.context.resolve(name)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.configuration-4.3.1-py3.7.egg/zope/configuration/config.py", line 246, in resolve
    __import__(moname)
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/five.grok-1.3.2-py3.7.egg/five/grok/__init__.py", line 22, in <module>
    from five.grok.components import Model, Container, Site, LocalUtility
  File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/five.grok-1.3.2-py3.7.egg/five/grok/components.py", line 21, in <module>
    from zope.location.interfaces import IPossibleSite
zope.configuration.xmlconfig.ZopeXMLConfigurationError: File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/plone.directives.form-2.0.3-py3.7.egg/plone/directives/form/meta.zcml", line 6.4-6.52
    File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/parts/instance/etc/site.zcml", line 12.2-12.39
    File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/Products.CMFPlone-5.2.0-py3.7.egg/Products/CMFPlone/meta.zcml", line 38.4-42.10
    File "/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/plone.app.dexterity-2.6.3-py3.7.egg/plone/app/dexterity/meta.zcml", line 7.2-8.62
    ImportError: cannot import name 'IPossibleSite' from 'zope.location.interfaces' (/home/ajung/sandboxes/dynamore-plone-5.2-upgrade/eggs/zope.location-4.2-py3.7.egg/zope/location/interfaces.py)

Googling a minute I found:

from zope.component.interfaces import IPossibleSite

Not sure if it works

AttributeError: module 'five' has no attribute 'grok'

five.grok gives you an attribute error because IPossibleSite is not there.
Anyway good point, the code should be degrokked.

The problem was the usage of plone.directives. Replacing this with the related imports for plone.supermodel.model and plone.autoform.directives solved the issue.

Plone Foundation Code of Conduct