twisted / twisted/klein

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

Open
#111 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
838
Forks
123
Avg merge
7h 58m
Merged PRs (30d)
12

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in klein/app.py at KleinRequest and the implements(IKleinRequest) call shown in the Python 3.5 stack trace. Reproduce the import with the provided Klein example and verify that Klein loads and the example runs without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.