cd34/apex

Python 3.5.1: TypeError: Class advice impossible in Python3. Use the @implementer class decorator instead

mazz opened this issue · 3 comments

mazz commented

Following the instructions at

http://thesoftwarestudio.com/apex/INSTALL.html

I add the line

config.include('apex', route_prefix='/auth')

to init.py

and re-run the pyramid webapp

but I get the stack below with the error ... Class advice impossible in Python3 ...

I'm using Python 3.5.1 Pyramid 1.7.3 and apex 0.9.11(on a mac). I'm not sure where the issue is exactly but it seems to be in apex:

  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/interfaces.py", line 14, in ApexImplementation
Traceback (most recent call last):
  File "../bin/pserve", line 9, in <module>
    load_entry_point('pyramid==1.7.3', 'console_scripts', 'pserve')()
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/scripts/pserve.py", line 60, in main
    return command.run()
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/scripts/pserve.py", line 371, in run
    global_conf=vars)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/scripts/pserve.py", line 406, in loadapp
    return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/util.py", line 58, in fix_call
    reraise(*exc_info)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/compat.py", line 32, in reraise
    raise e.with_traceback(tb)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/PasteDeploy-1.5.2-py3.5.egg/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/Users/me/tmp/env/apextest/example/example/__init__.py", line 11, in main
    config.include('apex', route_prefix='/auth')
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/config/__init__.py", line 771, in include
    c = self.maybe_dotted(callable)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/config/__init__.py", line 871, in maybe_dotted
    return self.name_resolver.maybe_resolve(dotted)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/path.py", line 320, in maybe_resolve
    return self._resolve(dotted, package)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/path.py", line 327, in _resolve
    return self._zope_dottedname_style(dotted, package)
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/pyramid-1.7.3-py3.5.egg/pyramid/path.py", line 376, in _zope_dottedname_style
    found = __import__(used)
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/__init__.py", line 18, in <module>
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/interfaces.py", line 10, in <module>
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/apex-0.9.11.dev0-py3.5.egg/apex/interfaces.py", line 14, in ApexImplementation
  File "/Users/me/tmp/env/apextest/lib/python3.5/site-packages/zope.interface-4.2.0-py3.5-macosx-10.6-intel.egg/zope/interface/declarations.py", line 412, in implements
    raise TypeError(_ADVICE_ERROR % 'implementer')
TypeError: Class advice impossible in Python3.  Use the @implementer class decorator instead.

Having the same issue in 2019! (3 year later)
Using python 3.7, apex 0.9.10.dev0 and zope 4.6.0-1.
image

cd34 commented

Fixed in 768f185

I'm sorry, I seem to still be having some trouble with this.
I installed the latest version with

pip3 install git+https://github.com/cd34/apex.git@31813545156ea8b9a595622ae65653f4592520d9

just to be sure and I still got:

File "/xxxx/xxxx/init.py", line 11, in main
config.include('apex', route_prefix='/auth')
File "/usr/local/lib/python3.6/dist-packages/pyramid/config/init.py", line 642, in include
c = self.maybe_dotted(callable)
File "/usr/local/lib/python3.6/dist-packages/pyramid/config/init.py", line 749, in maybe_dotted
return self.name_resolver.maybe_resolve(dotted)
File "/usr/local/lib/python3.6/dist-packages/pyramid/path.py", line 335, in maybe_resolve
return self._resolve(dotted, package)
File "/usr/local/lib/python3.6/dist-packages/pyramid/path.py", line 342, in _resolve
return self._zope_dottedname_style(dotted, package)
File "/usr/local/lib/python3.6/dist-packages/pyramid/path.py", line 391, in _zope_dottedname_style
found = import(used)
File "/usr/local/lib/python3.6/dist-packages/apex/init.py", line 18, in
from apex.interfaces import (ApexImplementation,
File "/usr/local/lib/python3.6/dist-packages/apex/interfaces.py", line 10, in
class ApexImplementation(object):
File "/usr/local/lib/python3.6/dist-packages/apex/interfaces.py", line 14, in ApexImplementation
implements(IApex)
File "/usr/local/lib/python3.6/dist-packages/zope/interface/declarations.py", line 706, in implements
raise TypeError(_ADVICE_ERROR % 'implementer')
TypeError: Class advice impossible in Python3. Use the @Implementer class decorator instead.