Well, I’ve tried to run another’s person telegram bot on my computer, but got a mistake that:
Traceback (most recent call last):
File "C:UsersDmitriyPycharmProjectspythonProjectMain.py", line 10, in <module>
keyboard = telebot.types.ReplyKeyboardMarkup(True, True)
AttributeError: module 'telebot' has no attribute 'types'
I’ve tried to import types from telebot:
from telebot import types
But it didn’t actually helped. The strangest thing is that this code works on code owner’s computer.
What can this be about?
4
Answers
You need to install python-telegram-bot f.e via pip
then import it from telegram package
and replace creation of ReplyKeyboardMarkup into this:
for like these errors … reinstall the library or use (–upgrade) when you install it !
like this:
Happy Coding!
The problem is that
telebot
andpyTelegramBotApi
are different libraries but they are both imported viaimport telebot
. In fact, when you dofrom telebot import types
you import it frompyTelegramBotApi
, not fromtelebot
.To fix the issue just type:
It worked for me 🙂
If you use PyCharm, then I advise you to do the following.