anime-dl / anime-downloader

A simple but powerful anime downloader and streamer.
The Unlicense
1.93k stars 218 forks source link

Python 3.9.10 breaks requests-cache with "TypeError: Invalid first argument to register(). ForwardRef(...) is not a class #734

Closed hunkyburrito closed 1 year ago

hunkyburrito commented 2 years ago

Describe the bug

This problem is not specific to anime downloader. See requests-cache#501

The fix to this issue is already implemented in requests-cache==0.9.1 so installing that version will resolve the problem.

To reproduce

Use python 3.9.10 environment

anime
LOG ``` ~ $ anime Traceback (most recent call last): File "/data/data/com.termux/files/usr/bin/anime", line 33, in sys.exit(load_entry_point('anime-downloader==5.0.18', 'console_scripts', 'anime')()) File "/data/data/com.termux/files/usr/bin/anime", line 25, in importlib_load_entry_point return next(matches).load() File "/data/data/com.termux/files/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load module = import_module(match.group('module')) File "/data/data/com.termux/files/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 992, in _find_and_load_unlocked File "", line 241, in _call_with_frames_removed File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/__init__.py", line 1, in from anime_downloader.sites import get_anime_class File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/sites/__init__.py", line 2, in from .anime import Anime File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/sites/anime.py", line 10, in from anime_downloader import util File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/util.py", line 23, in from anime_downloader import session File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/session.py", line 5, in import requests_cache File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/__init__.py", line 43, in from .backends import * File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/backends/__init__.py", line 8, in from .base import BaseCache, BaseStorage File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/backends/base.py", line 18, in from ..serializers import init_serializer File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/serializers/__init__.py", line 6, in from .preconf import ( File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/serializers/preconf.py", line 26, in base_stage = CattrStage() #: Base stage for all serializer pipelines File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/serializers/cattrs.py", line 32, in __init__ self.converter = init_converter(factory) File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/serializers/cattrs.py", line 67, in init_converter converter.register_structure_hook( File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/cattr/converters.py", line 269, in register_structure_hook self._structure_func.register_cls_list([(cl, func)]) File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/cattr/dispatch.py", line 57, in register_cls_list self._single_dispatch.register(cls, handler) File "/data/data/com.termux/files/usr/lib/python3.10/functools.py", line 856, in register raise TypeError( TypeError: Invalid first argument to `register()`. ForwardRef('CachedResponse') is not a class. ```