This error appears and I cannot run its script. I tried several ways and failed until I gave up, and I am just a step away from deleting the entire project. Are there anyone who can help me?
—————————————————————
Traceback (most recent call last):
File “main. py”, line 3, in
from telegram import InlineKeyboardButto
n, InlineKeyboardMarkup, Update
ImportError: cannot import name
InlineKeybo
ardButton’ from ‘telegram’ (/home/runner/bot
-tele-mane/venv/lib/python3.10/site-package
s/telegram/init.py)
ChatGPT right? Do not trust GPT’s code. It has no clue what module actually do most of the time, and will make stuff up. I recommend looking at official documentation on how to do this, as the InlineKeybaordButton thing doesn’t exist.
ChatGPT have outdated data, he can ask for you to install a previous version of the module. Be sure to use this when installing the package, so you can have the last version:
$ pip install python-telegram-bot --upgrade
In their documentation they said:
“You must use exactly one of the optional fields.” - This means that each InlineKeyboardButton you create should use exactly one of the optional parameters (text, url, callback_data, switch_inline_query, etc.). If you use more than one, it might not work as expected.