Weird ModuleNotFoundError: No module named 'plone.directives'

I am trying to get 'collective.googleauthenticator' to work with python 3 & Plone 5 / 6.

Where the add-on has used:

from plone.directives import form

I get:

ModuleNotFoundError: No module named 'plone.directives'

If I add one of my own add-ons that uses the same syntax, I do not get an error.
Does anyone have an idea of what can be causing this ?

Maybe it's better to import from z3c.form:
from z3c.form import form
e.g. like in this one:

plone.directives its an old product that mostly replaced by plone.autoform. See Plone.autoform vs. plone.directives.* - #3 by hvelarde this thread for historial context.

It does not come with default Plone, maybe you tested your other addon in other Plone where plone.directives it's installed or either it's pulled by your addon (in setup)

1 Like

I remember I tested this package quite some time ago.
You might have some luck reusing some of the branches you see here https://github.com/collective/collective.googleauthenticator/branches

No, it is on the same instance. If I run buildout and start with both add-ons installed, only googleauthenticator gives an error.
And it is not a typo, all the py files in /browser/forms gives the same error.

Thanks a lot.
I actually thought I had checked if there were branches (I did not find any)

Any idea what to change / migrate 'form.SchemaForm' to ?

https://docs.plone.org/develop/addons/schema-driven-forms/form-types/base-forms-and-schema-forms.html

Whenever you see an older add-on, degrokking and updating the forms to use plone.autoform is a common step...

Do you have any example for 'form.SchemaForm' (I am a bit lost here)

I don't but you can take a look at plone.restapi to see what is done there...

Did any of these work with 5.1 ( or 5.2 with python 2.7) for that matter (I need to install the add-on to see 'what is missing in my python 3 branch: GitHub - espenmn/collective.googleauthenticator: Two-step verification for Plone 4 using the Google Authenticator app.

I will try to update this add-on, but I would be very grateful if someone with more knowledge could give info on 'what I need to do':

For example:

  • How to update the 'login_form' when skins are gone
  • What to fix/change with 'users schema/user fields'

UPDATE: I installed Plone5.1.6 / python2.7, but of all things buildout tries to install Django. Is it supposed to ??

TypeError: Error when calling the metaclass bases
'property' object is not callable
An error occurred when trying to install /opt/plone/buildout-cache/downloads/dist/Django-4.0.2.tar.gz. Look above this message for any errors that were output by easy_install.
While:
  Installing instance.

I think the plone.autoform readme is the best start here: https://github.com/plone/plone.autoform#basic-schema-based-forms