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

IndexError: list index out of range #25

Closed
thuSunao opened this issue Dec 14, 2022 · 13 comments
Closed

IndexError: list index out of range #25

thuSunao opened this issue Dec 14, 2022 · 13 comments

Comments

@thuSunao
Copy link

I've got this problem in "api.send_message(msg)" function. How can I solve it?

@thuSunao
Copy link
Author

I've got this problem in "api.send_message(msg)" function. How can I solve it?

already upgraded to 0.3.8

@terry3041
Copy link
Owner

May I have the complete error log here?

@thuSunao
Copy link
Author

Traceback (most recent call last):
File "/home/sunao/sqa/models/run_gpt3.py", line 260, in
prediction, output = get_gpt3_result(prompt, args) # 'A', ..., 'E'
File "/home/sunao/sqa/models/run_gpt3.py", line 73, in get_gpt3_result
res = response.send_message(prompt)
File "/home/sunao/anaconda3/envs/sqa/lib/python3.10/site-packages/pyChatGPT/pyChatGPT.py", line 349, in send_message
request = self.driver.find_elements(
IndexError: list index out of range

and the function is
request = self.driver.find_elements(
By.XPATH, "//div[starts-with(@Class, 'request-:')]"
)[-1]

@terry3041
Copy link
Owner

terry3041 commented Dec 14, 2022

I cannot reproduce this error. Can you edit the site package like this and see if the error persist?

image

@eaffe
Copy link

eaffe commented Dec 14, 2022

i have the same problem.
The time.sleep(0.25) is already implemented in v0.3.8

@thuSunao
Copy link
Author

I cannot reproduce this error. Can you edit the site package like this and see if the error persist?

image

yes the error still persists.
but in v0.3.8 i found my code a little bit different from your pic
image

@terry3041
Copy link
Owner

yes the error still persists. but in v0.3.8 i found my code a little bit different from your pic

Sorry my bad. I forgot to push new version. Now in your pic, can you swap the "Get response element" and "Wait for response" part and see the result?

@thuSunao
Copy link
Author

i swapped and sadly still got the same error
and i tried to increase the sleep time from 0.25 to 1, but it still doesn't work

@eaffe
Copy link

eaffe commented Dec 14, 2022

i swapped and sadly still got the same error and i tried to increase the sleep time from 0.25 to 1, but it still doesn't work

same for me. 5 seconds doesn't help either

@thuSunao
Copy link
Author

I run my code in Linux server, does it cause the problem?

@terry3041
Copy link
Owner

I think I found the problem but let me make sure before I make new commit.

@thuSunao
Copy link
Author

thanks a lot!

@terry3041
Copy link
Owner

Hey. New release v0.3.9 should fix the problem. Please let me know if the problem still exist.

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

3 participants