KeyError: 'externalEditorEnabled' with collective.exportimport members import into Plone 6

I have this code for importing the export_members.json (collective.exportimport) into Plone 6
which gives me an error:

def import_members(site, ):

    fn = IMPORT_ROOT/ "export_members.json"
    if not fn.exists():
        return

    print(f"Import members from {fn}")
    with open(fn) as fp:
        data = fp.read()

    # Filter out members without login
    data = json.loads(data)

    view = api.content.get_view("import_members", context=site, request=site.REQUEST)
    view(data)
Traceback (most recent call last):
  File "/home/ajung/src/unibo/plone6/parts/instance/bin/interpreter", line 260, in <module>
    exec(_val)
  File "<string>", line 1, in <module>
  File "scripts/migration-import.py", line 493, in <module>
    import_members(site)
  File "scripts/migration-import.py", line 49, in import_members
    view(data)
  File "/home/ajung/src/unibo/plone6/eggs/collective.exportimport-1.9-py3.11.egg/collective/exportimport/import_other.py", line 209, in __call__
    return self.index()
           ^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/Products/Five/browser/pagetemplatefile.py", line 126, in __call__
    return self.__func__(__self__, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/Products/Five/browser/pagetemplatefile.py", line 58, in __call__
    s = self.pt_render(
        ^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/zope.pagetemplate-5.0-py3.11.egg/zope/pagetemplate/pagetemplate.py", line 134, in pt_render
    return self._v_program(
           ^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/Products/PageTemplates/engine.py", line 365, in __call__
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/z3c.pt-4.0-py3.11.egg/z3c/pt/pagetemplate.py", line 174, in render
    return base_renderer(**context)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Chameleon-4.0.0-py3.11-linux-x86_64.egg/chameleon/zpt/template.py", line 298, in render
    return super().render(**_kw)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Chameleon-4.0.0-py3.11-linux-x86_64.egg/chameleon/template.py", line 214, in render
    raise_with_traceback(exc, tb)
  File "/home/ajung/src/unibo/plone6/eggs/Chameleon-4.0.0-py3.11-linux-x86_64.egg/chameleon/utils.py", line 20, in raise_with_traceback
    raise exc
  File "/home/ajung/src/unibo/plone6/eggs/Chameleon-4.0.0-py3.11-linux-x86_64.egg/chameleon/template.py", line 190, in render
    self._render(stream, econtext, rcontext)
  File "/home/ajung/src/unibo/plone6/var/cache/687997e9952263e9ce772115bce82073.py", line 393, in render
    __m(__stream, econtext.copy(), rcontext, __i18n_domain)
  File "/home/ajung/src/unibo/plone6/var/cache/0daee0c607d704cd069dbe99fbb273ce.py", line 921, in render_master
    render_content(__stream, econtext.copy(), rcontext, __i18n_domain)
  File "/home/ajung/src/unibo/plone6/var/cache/0daee0c607d704cd069dbe99fbb273ce.py", line 1608, in render_content
    __cache_140108233945744 = _static_140108362120848('provider', 'plone.belowcontent', econtext=econtext)(_static_140108362112400(econtext, __zt_tmp))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/zope.contentprovider-5.0-py3.11.egg/zope/contentprovider/tales.py", line 76, in __call__
    provider.update()
  File "/home/ajung/src/unibo/plone6/eggs/zope.viewlet-5.0-py3.11.egg/zope/viewlet/manager.py", line 157, in update
    self._updateViewlets()
  File "/home/ajung/src/unibo/plone6/eggs/zope.viewlet-5.0-py3.11.egg/zope/viewlet/manager.py", line 163, in _updateViewlets
    viewlet.update()
  File "/home/ajung/src/unibo/plone6/eggs/plone.app.layout-4.0.6-py3.11.egg/plone/app/layout/viewlets/content.py", line 39, in update
    self.actions = self.context_state.actions("document_actions")
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/plone.memoize-3.0.2-py3.11.egg/plone/memoize/view.py", line 50, in memogetter
    cache[key] = func(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/plone.app.layout-4.0.6-py3.11.egg/plone/app/layout/globals/context.py", line 244, in actions
    atool.listActionInfos(
  File "/home/ajung/src/unibo/plone6/eggs/Products.CMFPlone-6.0.6-py3.11.egg/Products/CMFPlone/ActionsTool.py", line 83, in listActionInfos
    if check_condition and not ai["available"]:
                               ~~^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Products.CMFCore-3.0-py3.11.egg/Products/CMFCore/ActionInformation.py", line 211, in __getitem__
    value = self.data[key] = value(self._ec)
                             ^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Products.CMFCore-3.0-py3.11.egg/Products/CMFCore/Expression.py", line 53, in __call__
    res = compiled(econtext)
          ^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/zope.tales-5.2-py3.11.egg/zope/tales/expressions.py", line 250, in __call__
    return self._eval(econtext)
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/Products/PageTemplates/Expressions.py", line 213, in _eval
    ob = self._subexprs[-1](econtext)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/zope.tales-5.2-py3.11.egg/zope/tales/expressions.py", line 153, in _eval
    ob = self._traverser(ob, element, econtext)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/Products/PageTemplates/Expressions.py", line 82, in boboAwareZopeTraverse
    object = object.restrictedTraverse(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/OFS/Traversable.py", line 364, in restrictedTraverse
    return self.unrestrictedTraverse(path, default, restricted=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/OFS/Traversable.py", line 347, in unrestrictedTraverse
    raise e
  File "/home/ajung/src/unibo/plone6/eggs/Zope-5.8.3-py3.11.egg/OFS/Traversable.py", line 301, in unrestrictedTraverse
    next = obj[name]
           ~~~^^^^^^
  File "/home/ajung/src/unibo/plone6/eggs/plone.folder-4.0.0-py3.11.egg/plone/folder/ordered.py", line 229, in __getitem__
    raise KeyError(key)
KeyError: 'externalEditorEnabled'

Any idea?

Maybe something in portal_actions conditions?

Bare Plone installation, no add-ons...expectation to work out of the box :clown_face:

There's an action expression which relies on the ancient externalEditorEnabled script in portal_skins/plone_scripts ... in a vanilla Plone 6 installation this script is still present :cold_sweat:

check in portal_actions/document_actions/extedit the condition. I'd remove the action completely ...

It's strange though that this error appears in the import_members view ...

EDIT: If you're running this script with bin/instance run it might be that the ISkinsTool utility isn't registered correctly ... a BrowserView importer script might solve the problem also. Or you try to use zope.component.hooks.setSite to set up the global site manager.