TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc.
MIT License
123
stars
17
forks
source link
TypeError: 'type' object is not subscriptable (Error when using older version of python. i.e. less than 3.9) #34
There's an error when running the app on versions of python less than 3.9.
I get this error on Python 3.8.10
The error originates from the tweeterpy module:
TypeError: 'type' object is not subscriptable
This error is common when trying to use a subscript notation (like list[dict]) in a Python version that is older than 3.9. The script or module you're using seems to be written for Python 3.9 or later, while your environment seems to be running an older version of Python.
Solutions:
Upgrade Python:
Upgrading your Python version to 3.9 or later would be the most straightforward solution.
sudo apt-get install python3.9
Modify the Code:
If upgrading Python is not an option, you would need to modify the tweeterpy module's code to replace the subscript notation with the typing module's generics:
There's an error when running the app on versions of python less than 3.9.
I get this error on Python 3.8.10
The error originates from the tweeterpy module:
TypeError: 'type' object is not subscriptable
This error is common when trying to use a subscript notation (like list[dict]) in a Python version that is older than 3.9. The script or module you're using seems to be written for Python 3.9 or later, while your environment seems to be running an older version of Python.
Solutions: Upgrade Python: Upgrading your Python version to 3.9 or later would be the most straightforward solution.
sudo apt-get install python3.9
Modify the Code:
If upgrading Python is not an option, you would need to modify the tweeterpy module's code to replace the subscript notation with the typing module's generics:
Change this:
description_urls: list[dict] = field(default_factory=list)
To this:
from typing import List, Dict
description_urls: List[Dict] = field(default_factory=list)
These changes would need to be made wherever subscript notation is used within the tweeterpy module.
could declare 3.9 is required, or present alternative method ¯_(ツ)_/¯