Reputation: 1200
I am trying to create a telegram bot. The code i am trying to execute is :
from telegram import ParseMode
But it is throwing up this error:
ImportError: cannot import name 'ParseMode' from 'telegram'
(C:\ProgramData\Anaconda3\lib\site-packages\telegram\__init__.py)
Could you please advise how to fix this error?
Upvotes: 11
Views: 18324
Reputation: 11
and in case anyone else is using the TutorialBot.py file from GitLab, remember to change the "Filters" to from telegram.ext import filters
as discovered by this user
Upvotes: 1
Reputation: 77
Was confronted with this recently, and what worked for me is:
from telegram import ParseMode
Upvotes: 1
Reputation: 210
as per Version 20 you need to use:
from telegram.constants import ParseMode
Upvotes: 21
Reputation: 756
you have to import with this way:
from telegram.ext import ParseMode
if problem not solved:
install the package like this:
pip install python_telegram_bot
or
pip install "python_telegram_bot==12.4.2"
Upvotes: 2