stevedore – python3 load extension error

asked 2018-08-01 05:42:51 -0500

aidaph gravatar image

Hi,

I've changed my code to use stevedore and load the entry points configured in setup.py within my code through the stevedore extension. It works fine in python2.7 but python3.

When I load the extensions in python2, it returns a dict with my extensions correctly as below:

>>> from stevedore import extension
>>> mgr = extension.ExtensionManager(namespace='extractors',
... invoke_on_load=True)
>>> mgr.extensions
[<stevedore.extension.Extension object at 0x7ff4b8ea5d50>, <stevedore.extension.Extension object at 0x7ff4b646dd10>]

The same load in python3 returns a null dict:

>>> mgr.extensions
 [ ]

The test used in my code when I parse tox with py34 returns the following error:

>     Could not load 'extractorX': 'dict' object has no attribute
> 'iteritems'

When I googled this error, they said that iteritems function change to items for the python3X versions and it works just for python2.

Any help to make this work for both versions of python?

Many thanks and cheers,

Aida

edit retag flag offensive close merge delete