terry3041 / pyChatGPT

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

in Docker , api = ChatGPT(session_token) not work anymore. #125

Open HelloWorldWinning opened 1 year ago

HelloWorldWinning commented 1 year ago

in docker run: api = ChatGPT(session_token)

throw error below: (exact same session_token works well in debian , )

sadly. I cannot use Docker anymore.

i had dozens of docker images,that functioned well before today(2023-02-06 ).

=========

File "", line 1, in File "/usr/local/lib/python3.11/site-packages/pyChatGPT/pyChatGPT.py", line 126, in init self.init_browser() File "/usr/local/lib/python3.11/site-packages/pyChatGPT/pyChatGPT.py", line 223, in __init_browser self.ensure_cf() File "/usr/local/lib/python3.11/site-packages/pyChatGPT/pyChatGPT.py", line 244, in __ensure_cf WebDriverWait(self.driver, 10).until_not( File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 110, in until_not value = method(self._driver) ^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/support/expected_conditions.py", line 64, in _predicate return driver.find_element(*locator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 861, in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.evaluate threw exception: SyntaxError: missing ) after argument list (Session info: chrome=109.0.5414.119)

egorgam commented 1 year ago

I have this error too

brmi1 commented 1 year ago

I am also getting this error on my remote Ubuntu 22.04.1 headless server. To begin with, I updated the system and pip (using python 3.10.6, pip 23.0), and also installed the latest version of chromium-browser and xvfb, after which the system requested the installation of PyVirtualDisplay, which I did. As a result, I get this error:

Traceback (most recent call last):
  File "/home/main.py", line 4, in <module>
    api = ChatGPT(session_token)
  File "/usr/local/lib/python3.10/dist-packages/pyChatGPT/pyChatGPT.py", line 126, in __init__
    self.__init_browser()
  File "/usr/local/lib/python3.10/dist-packages/pyChatGPT/pyChatGPT.py", line 223, in __init_browser
    self.__ensure_cf()
  File "/usr/local/lib/python3.10/dist-packages/pyChatGPT/pyChatGPT.py", line 244, in __ensure_cf
    WebDriverWait(self.driver, 10).until_not(
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/support/wait.py", line 110, in until_not
    value = method(self._driver)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/support/expected_conditions.py", line 69, in _predicate
    return driver.find_element(*locator)
  File "/usr/local/lib/python3.10/dist-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.10/dist-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.10/dist-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.evaluate threw exception: SyntaxError: missing ) after argument list
  (Session info: chrome=109.0.5414.119)
Stacktrace: ...
iwaitu commented 1 year ago

I try to install chrome=110 in dockerfile ,but i got another error.

2023-02-12 06:37:56 Traceback (most recent call last):
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 1348, in do_open
2023-02-12 06:37:56     h.request(req.get_method(), req.selector, req.data, headers,
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/http/client.py", line 1282, in request
2023-02-12 06:37:56     self._send_request(method, url, body, headers, encode_chunked)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/http/client.py", line 1328, in _send_request
2023-02-12 06:37:56     self.endheaders(body, encode_chunked=encode_chunked)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/http/client.py", line 1277, in endheaders
2023-02-12 06:37:56     self._send_output(message_body, encode_chunked=encode_chunked)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/http/client.py", line 1037, in _send_output
2023-02-12 06:37:56     self.send(msg)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/http/client.py", line 975, in send
2023-02-12 06:37:56     self.connect()
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/http/client.py", line 1454, in connect
2023-02-12 06:37:56     self.sock = self._context.wrap_socket(self.sock,
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/ssl.py", line 513, in wrap_socket
2023-02-12 06:37:56     return self.sslsocket_class._create(
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/ssl.py", line 1071, in _create
2023-02-12 06:37:56     self.do_handshake()
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/ssl.py", line 1342, in do_handshake
2023-02-12 06:37:56     self._sslobj.do_handshake()
2023-02-12 06:37:56 ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:997)
2023-02-12 06:37:56 
2023-02-12 06:37:56 During handling of the above exception, another exception occurred:
2023-02-12 06:37:56 
2023-02-12 06:37:56 Traceback (most recent call last):
2023-02-12 06:37:56   File "/app/webapp.py", line 30, in <module>
2023-02-12 06:37:56     api = ChatGPT(session_token) 
2023-02-12 06:37:56   File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 126, in __init__
2023-02-12 06:37:56     self.__init_browser()
2023-02-12 06:37:56   File "/app/pyChatGPT/src/pyChatGPT/pyChatGPT.py", line 184, in __init_browser
2023-02-12 06:37:56     self.driver = uc.Chrome(options=options)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 246, in __init__
2023-02-12 06:37:56     self.patcher.auto()
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/site-packages/undetected_chromedriver/patcher.py", line 124, in auto
2023-02-12 06:37:56     release = self.fetch_release_number()
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/site-packages/undetected_chromedriver/patcher.py", line 145, in fetch_release_number
2023-02-12 06:37:56     return LooseVersion(urlopen(self.url_repo + path).read().decode())
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 216, in urlopen
2023-02-12 06:37:56     return opener.open(url, data, timeout)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 519, in open
2023-02-12 06:37:56     response = self._open(req, data)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 536, in _open
2023-02-12 06:37:56     result = self._call_chain(self.handle_open, protocol, protocol +
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 496, in _call_chain
2023-02-12 06:37:56     result = func(*args)
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 1391, in https_open
2023-02-12 06:37:56     return self.do_open(http.client.HTTPSConnection, req,
2023-02-12 06:37:56   File "/root/miniconda3/lib/python3.10/urllib/request.py", line 1351, in do_open
2023-02-12 06:37:56     raise URLError(err)
2023-02-12 06:37:56 urllib.error.URLError: <urlopen error EOF occurred in violation of protocol (_ssl.c:997)>
michaeledi commented 1 year ago

Same here...

HelloWorldWinning commented 1 year ago

Same here...

    options = uc.ChromeOptions()

    options.add_argument("--disable-dev-shm-usage")

options.add_argument("--headless") ?????? not verified. add options.add_argument("--disable-dev-shm-usage") ,this works