I am using python and getting this error.
- import telegram
- telegram.Bot(token = '###############')
When I run this, appears: "AttributeError: module 'telegram' has no attribute 'Bot'" Any ideas how to solve this?
I am using python and getting this error.
When I run this, appears: "AttributeError: module 'telegram' has no attribute 'Bot'" Any ideas how to solve this?
I assume you're referring to python-telegram-bot and that you solely use python-pip
for package installation (and not your OS's package manager):
~> pip3 list | grep -i telegram
python-telegram-bot 11.1.0
pip install --user --force-reinstall python-telegram-bot
telegram.py
within your project.It seems like you've installed the telegram
package (according to the comments). Uninstall that one, and then you need to go and choose one that gives you the Bot
class instead. For example:
Looks to me like the first one is more developed (the second one hasn't been touched in a while), but they have different licenses. Explore the options!
Note that your file name (.py) does not the same with your package name.
I have faced the same issue and founded comment in releated GitHub issue that if you run code in test.py
file you will have this issue. Maybe it will solve the issue for you.
If you're using PyCharm, and you're new to programming, to add the module, you need to add it to your project here:
© 2022 - 2024 — McMap. All rights reserved.
Bot
class would be for exampletelegram-bot
orpython-telegram-bot
, but we would need to know which one you intend to use – Hebbe