bellingcat / auto-archiver

Automatically archive links to videos, images, and social media content from Google Sheets (and more).
https://pypi.org/project/auto-archiver/
MIT License
489 stars 53 forks source link

Python versions below 3.10 not supported #146

Open ADarkDividedGem opened 1 week ago

ADarkDividedGem commented 1 week ago

I am using Python 3.9.13 and ran into the following error when I run auto-archiver --help

auto-archiver --help Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Dave\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\auto-archiver.exe\main__.py", line 4, in from auto_archiver.main import main File "C:\Users\Dave\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\auto_archiver\init.py", line 1, in from . import archivers, databases, enrichers, feeders, formatters, storages, utils, core File "C:\Users\Dave\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\auto_archiver\archivers\init__.py", line 3, in from .twitter_archiver import TwitterArchiver File "C:\Users\Dave\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\auto_archiver\archivers\twitter_archiver.py", line 15, in class TwitterArchiver(Archiver): File "C:\Users\Dave\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\auto_archiver\archivers\twitter_archiver.py", line 65, in TwitterArchiver def download_snscrape(self, item: Metadata, url: str, tweet_id: str) -> Union[Metadata|bool]: TypeError: unsupported operand type(s) for |: 'type' and 'type'

This happens because union types are only support in Python 3.10: https://peps.python.org/pep-0604/

To get round the issue I added from __future__ import annotations to the top of the twitter_archiver.py file. https://github.com/tiangolo/typer/issues/371#issuecomment-1073695552

Given your readme asks that "python 3.8 or higher" is installed I thought I would report this bug.