klein icon indicating copy to clipboard operation
klein copied to clipboard

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

Open cpg1111 opened this issue 8 years ago • 4 comments

Hi, I see to run into an error trying to create a Klein process. When using python 3.5.1, twisted 16.2.0 and Klein 0.2.3 (or 0.2.1) I receive a TypeError: Class advice impossible in Python3. Use the @implementer class decorator instead. on a rather basic bit of code:

from klein import Klein
from twisted import inlineCallbacks, returnValue

app = Klein()

@app.route("/")
@inlineCallbacks
def hello(request):
    returnValue("hello")

app.run("0.0.0.0", 8080)

I also import a separate module using umongo with txmongo, but I don't beleive those should collide.

This is the stack trace I receive:

raceback (most recent call last):
  File "/opt/src/auth.py", line 3, in <module>
    from klein import Klein
  File "/usr/local/lib/python3.5/site-packages/klein/__init__.py", line 1, in <module>
    from klein.app import Klein, run, route, resource
  File "/usr/local/lib/python3.5/site-packages/klein/app.py", line 32, in <module>
    class KleinRequest(object):
  File "/usr/local/lib/python3.5/site-packages/klein/app.py", line 33, in KleinRequest
    implements(IKleinRequest)
  File "/usr/local/lib/python3.5/site-packages/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.

cpg1111 avatar Jun 25 '16 03:06 cpg1111

Seems there's newer versions than what's on the github release page?

cpg1111 avatar Jun 25 '16 03:06 cpg1111

@cpg1111 Did you fix this? why is your Klein version so outdated? When installing in a virtualenv via pip the version of Klein (as at 24 November 2016) is: klein-15.3.1

Kentoseth avatar Nov 25 '16 00:11 Kentoseth

@Kentoseth I was specifying the version based on what was the release tag in the github repo's release page. I saw there were newer version in the separate documentation site. I'm curious why the documentation and the github releases are out of sync?

cpg1111 avatar Nov 25 '16 00:11 cpg1111

There's a 16.12 release out now; try that. The release process is still being sorted out.

wsanchez avatar Jan 26 '17 23:01 wsanchez