tornado v6 seems to have dropped tornado.web.asynchronous coroutine. any different way of fixing this in code?
Asked Answered
A

1

1

Migrated torando v5.1 to v6. but asynchronous coroutine seems to have removed. Any suggestions for its fix?

Migrating the project from 2.7 to 3.6, at the same time moving tornado framework from v5.1 to v6.0.2 due to the bug suggested in this [Python code for DynamoDB query is working on v3.6 but not working in python 2.7 strackoverflow thread.

After installing v6 tornado it is breaking with below error.

Python3 xxxx.py

Traceback (most recent call last):
  File "XXXX.py", line 200, in <module>
    class MainHandler(tornado.web.RequestHandler):
  File "XXXX.py", line 201, in MainHandler
    @tornado.web.asynchronous
AttributeError: module 'tornado.web' has no attribute 'asynchronous'

Come across https://github.com/mher/flower/issues/878 thread facing the same issue. is there a fix for this? or any alternative way of presenting things in code?

Acidulant answered 2/4, 2019 at 13:21 Comment(1)
This not an issue in the first place. You'll have to either use version 5 or update your code to work with version 6.Scuffle
C
3

The @asynchronous handler was deprecated in 5.1 and removed in 6.0. Instead of using @asynchronous and callbacks, you should use coroutines (using either @tornado.gen.coroutine or async def).

Note that a few older code examples used to have both @asynchronous and @coroutine on the same method. Putting @asynchronous on a coroutine doesn't do anything, so if you happen to be using both decorators you can just remove @asynchronous without changing anything else.

Charlottecharlottenburg answered 5/4, 2019 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.