Issue
I get this exception: "Exception has occurred: AttributeError __aenter__" in line async with bot:
. (I entered the token). Please help
import asyncio
import telegram
async def main():
bot = telegram.Bot("token")
async with bot:
print(await bot.get_me())
if __name__ == '__main__':
asyncio.run(main())
I found this code here: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API
Solution
Probobly that exception comming because you installed python-telegram-bot version 13.x.
try to:
pip freeze
for check that, and if that true you have to make
pip install python-telegram-bot --pre
because only unstable version use async.
Answered By - Comrade
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.