terry3041 / pyChatGPT

An unofficial Python wrapper for OpenAI's ChatGPT API
GNU General Public License v3.0
1.35k stars 255 forks source link

IndexError: list index out of range #114

Closed KarthikEcon closed 1 year ago

KarthikEcon commented 1 year ago

Hi,

Thanks for developing this cool package. When I try the suggested code resp = api.send_message('Hello, world!')

I see the package successfully open chrome, log in, submit the message, and get a response. However, the code errors out in the following way:


IndexError                                Traceback (most recent call last)
Input In [34], in <module>
----> 1 resp = api.send_message('Hello, world!')

File ~/.pyenv/versions/3.10.1/lib/python3.10/site-packages/pyChatGPT/pyChatGPT.py:393, in ChatGPT.send_message(self, message)
    391 # Get the response element
    392 self.__verbose_print('[send_msg] Finding response element')
--> 393 response = self.driver.find_elements(
    394     By.XPATH, "//div[starts-with(@class, 'request-:')]"
    395 )[-1]
    397 # Check if the response is an error
    398 self.__verbose_print('[send_msg] Checking if response is an error')

IndexError: list index out of range

Sorry if this is just an issue on my end.

terry3041 commented 1 year ago

Update your library.

KarthikEcon commented 1 year ago

That worked! Sorry, should have tried that before asking.