SocialSisterYi / xuexiaoyi-to-xuexitong-tampermonkey-proxy

基于“学小易”搜题API的学习通答题/考试油猴脚本题库代理
MIT License
168 stars 20 forks source link

大佬,请问如下报错应如何处理,谢谢 #10

Closed 19819068211 closed 2 years ago

19819068211 commented 2 years ago

大佬,请问如下报错应如何处理,谢谢 image C:\Users\jl\Downloads\xuexiaoyi-to-xuexitong-tampermonkey-proxy-main>python app.py Traceback (most recent call last): File "app.py", line 11, in import cxsecret_font File "C:\Users\jl\Downloads\xuexiaoyi-to-xuexitong-tampermonkey-proxy-main\cxsecret_font.py", line 19, in class FontHashDAO: File "C:\Users\jl\Downloads\xuexiaoyi-to-xuexitong-tampermonkey-proxy-main\cxsecret_font.py", line 21, in FontHashDAO char_map: dict[str, str] # unicode -> hsah TypeError: 'type' object is not subscriptable

SocialSisterYi commented 2 years ago

已经修复,变量名和内置函数冲突了

19819068211 commented 2 years ago

image 使用了最新的可还是这样报错

SocialSisterYi commented 2 years ago

检查你的python版本

19819068211 commented 2 years ago

python版本3.8,应该满足3.6以上了,请问哪个版本的python可以支持,谢谢 image

SocialSisterYi commented 2 years ago

python版本3.8,应该满足3.6以上了,请问哪个版本的python可以支持,谢谢 image

我理解了,这里用了 Py 3.9 的一个类型注解特性 GenericAlias 类型 所以低版本会报错,把注解中的dict改为typing.Dict就解决了

19819068211 commented 2 years ago

image 不好意思再次打扰,又有报错

19819068211 commented 2 years ago

image items: list[dict] TypeError: 'type' object is not subscriptable

19819068211 commented 2 years ago

image def get(self, index: int=0) -> tuple[str, str]: TypeError: 'type' object is not subscriptable