Unable to run Python Telegram Bot Package - Error
Asked Answered
B

1

-1

Hello StackOverFlow Community.

I am working on a telegram bot but facing the error:

(stockAlert) PS D:\Development\StockAlert> python .\stockAlertBot.py Traceback (most recent call last): File "D:\Development\StockAlert\stockAlertBot.py", line 1, in <module> from telegram.ext.updater import Updater ModuleNotFoundError: No module named 'telegram.ext.updater'

  • I had worked on the same file on my Mac earlier but when I am trying to run it on a Windows machine it is not working.

Error Message: Error

Here is the list of installed packages: package_list

  • OS: Windows 11 Pro
  • Python Version: 3.9.15

Your help is appreciated. Thank you !

Things that I tried:

  • Uninstalling and installing the package
  • Created a new virtual environment and installing the package
  • Rebooting the system
Breadbasket answered 9/1, 2023 at 23:58 Comment(2)
Please don't post screenshots of text/data/code/errors. They can't be searched or copied, or even consumed by users of adaptive technologies like screen readers. Instead, paste the code as text directly into your question/answer. If you select it and click the {} button or Ctrl+K the code block will be indented by four spaces, which will cause it to be rendered as code. Please edit your question to turn the image into well-formatted text.Aghast
Please provide enough code so others can better understand or reproduce the problem.Sacred
L
1

You have installed version 20.0 of python-telegram-bot but your code is written for version <=13.5. Please either upgrade your code to v20 by reading the release notes and the transition guide o install a version of PTB that is compatible with your code base.


Disclaimer: I'm currently the maintainer of python-telgeram-bot.

Laconism answered 10/1, 2023 at 17:16 Comment(7)
The standard python example on Telegram documentation is still written for 13.5, I guess that is where the confusion comes fromFresnel
Which example are you referring to? Do you have a link?Laconism
core.telegram.org/bots/tutorial this one, when you select Python: gitlab.com/Athamaxy/telegram-bot-tutorial/-/blob/main/…Fresnel
Interesting, hadn't known that. Thanks for the tip! TBF, they do explicitly state the required version, so that's as explicit as you can do it, I guess …Laconism
I don't see where the requirement version is mentioned. Most users would expect that the script provided works with the latestFresnel
It's mentioned in the readme. The PTB team is currently checking if we can get the code updatedLaconism
I dont think anyone would go up one level to open the readme since you are directly directed on that script from the page. Thanks for flagging to the teamFresnel

© 2022 - 2025 — McMap. All rights reserved.