terry3041 / pyChatGPT

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

error in docker #131

Open iwaitu opened 1 year ago

iwaitu commented 1 year ago

error logs ...

root@d8777e944388:/app# python test.py
Traceback (most recent call last):
  File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 244, in __ensure_cf
    WebDriverWait(self.driver, 10).until_not(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 118, in until_not
    raise TimeoutException(message)
selenium.common.exceptions.TimeoutException: Message:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/test.py", line 4, in <module>
    api  = ChatGPT(sesstion_token)
  File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 126, in __init__
    self.__init_browser()
  File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 223, in __init_browser
    self.__ensure_cf()
  File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 254, in __ensure_cf
    return self.__ensure_cf(retry - 1)
  File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 261, in __ensure_cf
    response = self.driver.find_element(By.TAG_NAME, 'pre').text
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 830, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"tag name","selector":"pre"}
  (Session info: chrome=110.0.5481.77)

test.py


from pyChatGPT import ChatGPT

session_token = "xxx"
api  = ChatGPT(sesstion_token)
result = api.send_message("hello")
print(result["message"])

I can run these codes normally, but it will fail in the container.