Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hunkyburrito opened this issue Apr 2, 2022 · 0 comments

Comments

@hunkyburrito
Copy link

hunkyburrito commented Apr 2, 2022

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 <module>              
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 "<frozen importlib._bootstrap>", line 1050, in _gcd_import                   
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load                
File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked        
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed      
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import                   
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load                
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked       
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked                 
File "<frozen importlib._bootstrap_external>", line 883, in exec_module           
File "<frozen importlib._bootstrap>", 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 <module>                                                 
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 <module>                                           
from .anime import Anime                                                        
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/sites/anime.py", line 10, in <module>                                             
from anime_downloader import util                                               
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/util.py", line 23, in <module>                                                    
from anime_downloader import session                                            
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/anime_downloader/session.py", line 5, in <module>                                                  
import requests_cache                                                           
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/__init__.py", line 43, in <module>                                                  
from .backends import *                                                         
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/backends/__init__.py", line 8, in <module>                                          
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 <module>                                             
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 <module>                                       
from .preconf import (                                                          
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/requests_cache/serializers/preconf.py", line 26, in <module>                                       
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.

@anime-dl anime-dl deleted a comment from Fantasy-Boss Sep 12, 2022
@hunkyburrito hunkyburrito closed this as not planned Won't fix, can't repro, duplicate, stale Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant