Reputation: 37
I have installed the python-telegram-bot package through pip and pip3 on ubuntu and tried to load it with:
from telegram.ext import Updater, CommandHandler
I then get:
File "/usr/local/lib/python3.5/dist-packages/telegram/base.py", line 42
_id_attrs: Tuple[Any, ...] = ()
^
SyntaxError: invalid syntax
I get a similar error for the python 2.7 version. The "base.py" file has a line with "_id_attrs:
", I've been using python for a while and never have seen a variable name followed by a colon. What is meant to make this line readable to python.
Upvotes: 1
Views: 2094
Reputation: 7548
You will have to update your python version to at least 3.6. The syntax (from the error) is introduced in python 3.6 (check PEP-526).
Also, It's clearly stated in the library's Documentation that you must use v3.6+.
This library provides a pure Python interface for the Telegram Bot API.
It's compatible with Python versions 3.6+.
PTB might also work on PyPy, though there have been a lot of issues before. Hence, PyPy is not officially supported.
Upvotes: 5