acheong08 / Bard

Python SDK/API for reverse engineered Google Bard
MIT License
1.42k stars 178 forks source link

IndexError: list index out of range #22

Closed krirk-n closed 1 year ago

krirk-n commented 1 year ago

It worked perfectly fine a few days ago. It just happened today. I tried updating my 1PSID already, but it didn't help.

chatbot.ask("hi")
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In [22], line 1
----> 1 chatbot.ask("hi")

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\Bard.py:127, in Chatbot.ask(self, message)
    119 # do the request!
    120 resp = self.session.post(
    121     "https://bard.google.com/_/BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate",
    122     params=params,
    123     data=data,
    124     timeout=120,
    125 )
--> 127 chat_data = json.loads(resp.content.splitlines()[3])[0][2]
    128 if not chat_data:
    129     return {"content": f"Google Bard encountered an error: {resp.content}."}

IndexError: list index out of range
krirk-n commented 1 year ago

updated: It works fine on python script file. But doesn't work on ipynb somehow.

Delamcode commented 1 year ago

I’m getting this too (not with a notebook)… not sure what to do

krirk-n commented 1 year ago

I’m getting this too (not with a notebook)… not sure what to do

Hi @Delamcode

In my case, it is just miraculously solved on its own. ngl, I haven't even touched anything. So if your code worked fine before this error occurred out of nowhere like my case, I would suggest you restart your jupyter, computer, environment, etc. Then pray to the lord and hope he will fix it in a few days of his business hours.

Delamcode commented 1 year ago

Lol ok.