theAbdoSabbagh / UnlimitedGPT

An unofficial Python wrapper for OpenAI's ChatGPT API
https://pypi.org/project/UnlimitedGPT/
GNU General Public License v3.0
346 stars 43 forks source link

WebDriver.__init__() got an unexpected keyword argument 'executable_path' #11

Closed kuoluo1995 closed 1 year ago

kuoluo1995 commented 1 year ago

Hi, I found that I can't run unlimitedGPT, either on win11 or on ubuntu.

I installed the latest installer successfully, then ran the code and got this error.

from UnlimitedGPT import ChatGPT
session_token =""
chatbot = ChatGPT(session_token)

Error Message or Traceback

Traceback (most recent call last):
  File "D:\miniconda3\envs\chatgpt\Lib\runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\miniconda3\envs\chatgpt\Lib\runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "c:\Users\Kuoluo\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>     
    cli.main()
  File "c:\Users\Kuoluo\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
    run()
  File "c:\Users\Kuoluo\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
    runpy.run_path(target, run_name="__main__")
  File "c:\Users\Kuoluo\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
    return _run_module_code(code, init_globals, run_name,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\Kuoluo\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code     
    _run_code(code, mod_globals, init_globals,
  File "c:\Users\Kuoluo\.vscode\extensions\ms-python.python-2023.10.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
    exec(code, run_globals)
  File "F:\Projects\ChartGPT\chartGPT.py", line 13, in <module>
    chatbot = ChatGPT(session_token)
              ^^^^^^^^^^^^^^^^^^^^^^
  File "D:\miniconda3\envs\chatgpt\Lib\site-packages\UnlimitedGPT\UnlimitedGPT.py", line 148, in _init_browser
    self.driver = ChatGPTDriver(options=options, headless=self._headless)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\miniconda3\envs\chatgpt\Lib\site-packages\UnlimitedGPT\internal\driver.py", line 11, in __init__
    super().__init__(options=options, headless=headless)
  File "D:\miniconda3\envs\chatgpt\Lib\site-packages\undetected_chromedriver\__init__.py", line 453, in __init__
    super(Chrome, self).__init__(
TypeError: WebDriver.__init__() got an unexpected keyword argument 'executable_path'
Exception ignored in: <function Chrome.__del__ at 0x000001C1F6522E80>
Traceback (most recent call last):
  File "D:\miniconda3\envs\chatgpt\Lib\site-packages\undetected_chromedriver\__init__.py", line 800, in __del__
  File "D:\miniconda3\envs\chatgpt\Lib\site-packages\undetected_chromedriver\__init__.py", line 755, in quit

Environment Information

kuoluo1995 commented 1 year ago

I found that the problem was with selenium 4.10, and I solved the problem temporarily by doing the above.

pip uninstall selenium
pip install selenium==4.9.1

The solution comes from: https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues/1318

Uranium2 commented 1 year ago

Seems that the package undetected-chromedriver made a new release. Can you try to force update it and try?

pip uninstall undetected-chromedriver 
pip install -U undetected-chromedriver

I also had the same issue yesterday while using the repo

theAbdoSabbagh commented 1 year ago

i, as you can see in the traceback, this issue is caused by undetected-chromedriver and not UnlimitedGPT, thus rendering this issue invalid.

On another note, I've been considering not using undetected-chromedriver and switching to the normal selenium library, but I haven't made a final decision yet. I will close the issue since it is invalid, and you have also found a fix for your problem. If you encounter any other bugs related to UnlimitedGPT, please don't hesitate to open a new issue here