I am a beginner with python-telegram-bot, I have installed version 20.0.
I installed a package "django-telegram bot" to help me integrate python-telegram-bot into django but I got an import error upon running the code
ImportError: cannot import name "Dispatcher" from telegram.ext
I delved into the python-telegram-bot package and discovered that there is no module called Dispatcher, but several online tutorials directly imported Dispatcher from telegram.ext.
2
Answers
To import the dispatcher module, you’ll first need to install the python-telegram-bot package. It looks like, from the question you have done this.
then all you have to do is this:
it is not imported from
telegram.ext
. from what i can see thetelegram.ext
part looks like this.and that reqires a bot which is derived from this:
Which is different to what is suggested in the original question.
The
django-telegram-bot
library is just not compatible with version 20 ofpython-telegram-bot
. As you can see in the requirements file it requires the ancient version 5.3.0 ofpython-telegram-bot
(it was released on 2016-12-11).Disclaimer: I’m currently the maintainer of
python-telegram-bot
.