ModuleNotFoundError: No module named 'telegram.utils'
Question:
I have installed python-telegram-bot like:
pip install python-telegram-bot
When I’m try to do this:
from telegram.ext import Updater, CommandHandler, MessageHandler, filters
from telegram.utils.helpers import escape_markdown
I get this error:
ModuleNotFoundError: No module named 'telegram.utils'
Answers:
See telegram sourcecode:
The function escape_markdown
is located in telegram/helpers.py
, so the correct import should be next:
root@shdebian1:~# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from telegram.helpers import escape_markdown
I have installed python-telegram-bot like:
pip install python-telegram-bot
When I’m try to do this:
from telegram.ext import Updater, CommandHandler, MessageHandler, filters
from telegram.utils.helpers import escape_markdown
I get this error:
ModuleNotFoundError: No module named 'telegram.utils'
See telegram sourcecode:
The function escape_markdown
is located in telegram/helpers.py
, so the correct import should be next:
root@shdebian1:~# python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from telegram.helpers import escape_markdown