Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Unable to import ParseMode #3005

Closed
super22n opened this issue May 7, 2022 · 2 comments
Closed

[QUESTION] Unable to import ParseMode #3005

super22n opened this issue May 7, 2022 · 2 comments

Comments

@super22n
Copy link

super22n commented May 7, 2022

Issue I am facing

I noticed some articles were updated recently, so I just downloaded python-telegram-bot again and now when I try to run my code, I get an error saying that I cannot import ParseMode. I am using ParseMode to send a message to Telegram.

Traceback to the issue

Traceback (most recent call last):
  File "./main.py", line 6, in <module>
    from telegram import Update, ParseMode
ImportError: cannot import name 'ParseMode' from 'telegram' (/usr/local/lib/python3.7/dist-packages/python_telegram_bot-20.0a0-py3.7.egg/telegram/__init__.py)

Related part of your code

from telegram import Update, ParseMode
async def start(update, context):
    await context.bot.send_message(chat_id=update.message.chat_id, text="My text", parse_mode=ParseMode.MARKDOWN)

Operating System

Debian 10

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 20.0a0
Bot API 6.0
Python 3.7.3 (default, Jan 22 2021, 20:04:44)  [GCC 8.3.0]
@super22n super22n changed the title [QUESTION] [QUESTION] Unable to import ParseMode May 7, 2022
Copy link
Member

@super22n as per Version 20 you need to use from telegram.constants import ParseMode

@super22n
Copy link
Author

super22n commented May 7, 2022

Ah I see. Ok it works now thanks.

@super22n super22n closed this as completed May 7, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants