Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

always show IndexError: list index out of range #67

Open
zchengzhong opened this issue Jul 15, 2023 · 1 comment
Open

always show IndexError: list index out of range #67

zchengzhong opened this issue Jul 15, 2023 · 1 comment

Comments

@zchengzhong
Copy link

GooglBard version is 1.4.0
i use:
chatbot = Chatbot(token)
chatbot.ask(tempQuest)

and the token is useful
Traceback (most recent call last):
File "F:\github\chatgpts\EdgeGPT-master\src\classifyMilitaryUnits\ChatGoogleBardMilitaryUnitsSecond.py", line 187, in
dealStartIndex = process_classify_data(df, tokenArr[tokenIndex], dealStartIndex)
File "F:\github\chatgpts\EdgeGPT-master\src\classifyMilitaryUnits\ChatGoogleBardMilitaryUnitsSecond.py", line 112, in process_classify_data
result = chatbot.ask(tempQuest)
File "G:\soft\Anaconda3\envs\py39\lib\site-packages\Bard.py", line 83, in ask
return self.loop.run_until_complete(self.async_chatbot.ask(message))
File "G:\soft\Anaconda3\envs\py39\lib\asyncio\base_events.py", line 647, in run_until_complete
return future.result()
File "G:\soft\Anaconda3\envs\py39\lib\site-packages\Bard.py", line 260, in ask
chat_data = json.loads(resp.content.splitlines()[3])[0][2]
IndexError: list index out of range

@zchengzhong
Copy link
Author

and use code to fix:

    try:
        chat_data = json.loads(resp.content.splitlines()[3])[0][2]
    except:
        chat_data=""

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant