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

TypeError: 'type' object is not subscriptable #438

Closed
jacket230 opened this issue Jan 25, 2024 · 19 comments · Fixed by #439
Closed

TypeError: 'type' object is not subscriptable #438

jacket230 opened this issue Jan 25, 2024 · 19 comments · Fixed by #439

Comments

@jacket230
Copy link

def videos(self) -> list[BardYoutubeVideo]:

TypeError: 'type' object is not subscriptable

@yihong0618
Copy link
Owner

you use bard?
please try gemini, will take a look this issue later

@jacket230
Copy link
Author

Traceback (most recent call last):
File "xiaogpt.py", line 2, in
from xiaogpt.cli import main
File "c:\xiaogpt-main\xiaogpt\cli.py", line 5, in
from xiaogpt.xiaogpt import MiGPT
File "c:\xiaogpt-main\xiaogpt\xiaogpt.py", line 18, in
from xiaogpt.bot import get_bot
File "c:\xiaogpt-main\xiaogpt\bot_init_.py", line 8, in
from xiaogpt.bot.bard_bot import BardBot
File "c:\xiaogpt-main\xiaogpt\bot\bard_bot.py", line 6, in
from bardapi import BardAsync
File "C:\Users\jack\AppData\Local\Programs\Python\Python38\lib\site-packages\bardapi_init_.py", line 4, in
from bardapi.core import Bard
File "C:\Users\jack\AppData\Local\Programs\Python\Python38\lib\site-packages\bardapi\core.py", line 30, in
from bardapi.models.result import BardResult
File "C:\Users\jack\AppData\Local\Programs\Python\Python38\lib\site-packages\bardapi\models\result.py", line 3, in
from bardapi.models.draft import BardDraft
File "C:\Users\jack\AppData\Local\Programs\Python\Python38\lib\site-packages\bardapi\models\draft.py", line 14, in
from bardapi.models.tools.youtube import BardYoutubeContent
File "C:\Users\jack\AppData\Local\Programs\Python\Python38\lib\site-packages\bardapi\models\tools\youtube.py", line 38, in
class BardYoutubeContent(UserContent):
File "C:\Users\jack\AppData\Local\Programs\Python\Python38\lib\site-packages\bardapi\models\tools\youtube.py", line 63, in BardYoutubeContent
def videos(self) -> list[BardYoutubeVideo]:
TypeError: 'type' object is not subscriptable

@jacket230
Copy link
Author

"verbose": false,
"bot": "chatgptapi",
"tts": "mi",
"edge_tts_voice": "zh-CN-XiaoxiaoNeural",

@jacket230
Copy link
Author

"openai_key": "sk-N**************",
"glm_key": "",
"gemini_key": "",
"qwen_key": "",
"bard_token": "",
"serpapi_api_key": "",

@jacket230
Copy link
Author

没有用bard,为啥会跑到bard这个逻辑里面去了呢?

@yihong0618
Copy link
Owner

@jacket230
先试试这个 pip install bardapi==0.1.38

@jacket230
Copy link
Author

安装了这个包,还是一样的提示。我的启动命令是不是不对?
python xiaogpt.py --hardware LX05 --mute_xiaoai --use_gpt3

@yihong0618
Copy link
Owner

对但别用 gpt3 用 chatgptapi

@jacket230
Copy link
Author

python xiaogpt.py --hardware LX05 --mute_xiaoai --use_chatgptapi
这个错误依然出现,我安装的时候用的:
pip install -U --force-reinstall xiaogpt

ef videos(self) -> list[BardYoutubeVideo]:
TypeError: 'type' object is not subscriptable

@yihong0618
Copy link
Owner

pip install -U --force-reinstall xiaogpt
pip install bardapi==0.1.38

@jacket230
Copy link
Author

pip install -U --force-reinstall xiaogpt pip install bardapi==0.1.38

重新执行了这两个命令,还是提示TypeError: 'type' object is not subscriptable

@frostming
Copy link
Collaborator

重新执行了这两个命令,还是提示TypeError: 'type' object is not subscriptable

用python 3.9以上,直接没烦恼

@jacket230
Copy link
Author

重新执行了这两个命令,还是提示TypeError: 'type' object is not subscriptable

用python 3.9以上,直接没烦恼

好嘞,我试试3.9以上,我现在是3.8.

@yihong0618
Copy link
Owner

@jacket230 3.9 可以了么?如果没问题我去上游提个 issue

@jacket230
Copy link
Author

@jacket230 3.9 可以了么?如果没问题我去上游提个 issue

还在安装,为啥说:
INFO: pip is looking at multiple versions of numpy to determine which version is compatible with other requirements. This could take a while.

在下所有的版本。

@yihong0618
Copy link
Owner

为啥我们需要 numpy 啊我研究下。。

@jacket230
Copy link
Author

为啥我们需要 numpy 啊我研究下。。

我忘记执行:
requrements了。先执行-r require,就不会有这个问题。

另外升级了3.9就可以了,不出现:TypeError: 'type' object is not subscriptable。
此前出现问题,3.8.1的python版本,建议升级3.9以上。
如果是win7可以参考:
https://blog.csdn.net/weixin_45454897/article/details/129333857

@yihong0618
Copy link
Owner

好的。

@frostming
Copy link
Collaborator

pip install bardapi==0.1.38

要退到 0.1.37才是好的

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

Successfully merging a pull request may close this issue.

3 participants