Issue
I need to use aioflask for seting webhooks for my telegram-bot. Here my code, where I set webhook:
from aioflask import Flask, request
...
app = Flask(__name__)
...
@app.route('/')
async def webhook():
await bot.delete_webhook()
await bot.set_webhook(url=APP_URL)
return '!', 200
...
But, when I run app, it give me this error:
Traceback (most recent call last):
File "D:/Python_Projects/FilmMarketBot/check.py", line 1, in <module>
from aioflask import Flask, request
File "D:\Python_Projects\FilmMarketBot\venv\lib\site-packages\aioflask\__init__.py", line 2, in <module>
from .app import Flask
File "D:\Python_Projects\FilmMarketBot\venv\lib\site-packages\aioflask\app.py", line 14, in <module>
from .ctx import AppContext, RequestContext
File "D:\Python_Projects\FilmMarketBot\venv\lib\site-packages\aioflask\ctx.py", line 4, in <module>
from flask.ctx import AppContext as OriginalAppContext, \
ImportError: cannot import name '_app_ctx_stack' from 'flask.ctx' (D:\Python_Projects\FilmMarketBot\venv\lib\site-packages\flask\ctx.py)
Please, tell how can I fix it. ...Why always me?
Solution
There seems to be a breaking change in Flask 2.2.0, which causes this incompatibility. As a workaround you can downgrade your Flask package to 2.1.3. This change solved the issue for me.
Reported the issue on GitHub: https://github.com/miguelgrinberg/aioflask/issues/10
Answered By - Agita
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.