David Bain
David Bain

Reputation: 2569

Plone 4.3a2 migrated from Plone 4.2.1 gives an Archetypes ImportError: cannot import name Schema error

I have been using Plone 4.2 without problems but want to test my site with the upcoming Plone 4.3. I edited my buildout to use Plone 4.3a2 and reran buildout.

Now I get ImportError: cannot import name Schema.

This is what my extends section now looks like (I've included the commented out old reference to Plone 4.2 which has been replaced with the new Plone 4.3a2 url).

extends =
    deco.cfg
    toolbar.cfg
    users-ports.cfg
    base.cfg
    supervisor-cache-balancer.cfg
    products.cfg
#    versions.cfg
#    http://dist.plone.org/release/4.2-latest/versions.cfg
   http://dist.plone.org/release/4.3a2/versions.cfg
   pinnedversions.cfg

After rerunning buildout and launching my instance using bin/client1 fg

I get the following traceback:

from Products.ATContentTypes.criteria import _criterionRegistry
  File "/home/plone/buildout-cache/eggs/Products.ATContentTypes-2.1.7-py2.7.egg/Products/ATContentTypes/criteria/__init__.py", line 123, in <module>
    from Products.ATContentTypes.criteria.relativepath import ATRelativePathCriterion
  File "/home/plone/buildout-cache/eggs/Products.ATContentTypes-2.1.7-py2.7.egg/Products/ATContentTypes/criteria/relativepath.py", line 7, in <module>
    from Products.Archetypes.public import Schema, DisplayList
ImportError: cannot import name Schema

I've even tried to pin Archetypes and ATContentypes so that the buildout uses older versions (example those used in Plone 4.2) by adding the following to my pinnedversions.cfg file (which gets called after everything else).

[versions]
Products.ATContentTypes = 2.1.7
Products.Archetypes = 1.7.14

Even then there seems to be more to it than that, the ImportError: cannot import name Schema error persists. It does not matter what versions I use in the pinnedversions.cfg file it does not work.

All my investigations suggest that this should "just work". Here's what I've inspected so far:

  1. Using bin/client1 debug for troubleshooting I discovered that from Products.Archetypes import Schema, from Products.Archetypes.Schema import Schema and from Products.Archetypes.atapi import Schema all work.

  2. When I open the Products.Archetypes public.py file it includes the following line:

     from Products.Archetypes.atapi import *
    

    My understanding is that such a line would make it possible to import Schema from public.py

Upvotes: 0

Views: 475

Answers (2)

kiorky
kiorky

Reputation: 299

Just to confirm that enabling products.kupu causes problems for me too.

The problem is fixed on latest plone.app.upgrade, see https://github.com/plone/plone.app.upgrade/commit/676f43c9c9c56eb686e20a5d0c7319540e7bab3f

Upvotes: 1

David Bain
David Bain

Reputation: 2569

After further investigation between a clean 4.3a2 buildout and my buildout, the difference was Products.kupu, commenting out Product.kupu from my eggs section and rerunning buildout solved the problem.

I have not investigated the reason this solves the problem, but it does.

Upvotes: 0

Related Questions