ChatGPT
ChatGPT copied to clipboard
Adding the --headless option.
Is your feature request related to a problem? Please describe.
I am trying to run this on a server, but it doesn't work on the server when --headless
is disabled.
Describe the solution you'd like
Adding the --headless
option to Chrome Options should help fix this.
Additional context I tried adding headless mode on a fork, but then a new problem arises, no cookies. I am not able to solve this problem and that's where I would like you help.
I also run this on a server, here's my solution to the problem: https://github.com/acheong08/ChatGPT/discussions/396
But, of course, it's a workaround. Headless option would be nice.
Thanks for the help!
My issue is slightly different though:
Spawning browser...
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/revChatGPT/ChatGPT.py", line 401, in get_cf_cookies
driver = uc.Chrome(
File "/opt/venv/lib/python3.8/site-packages/undetected_chromedriver/__init__.py", line 411, in __init__
browser = subprocess.Popen(
File "/nix/store/zzfhcf101498slkcfgi085jqd33rjf95-python3-3.8.16/lib/python3.8/subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/nix/store/zzfhcf101498slkcfgi085jqd33rjf95-python3-3.8.16/lib/python3.8/subprocess.py", line 1585, in _execute_child
and os.path.dirname(executable)
File "/nix/store/zzfhcf101498slkcfgi085jqd33rjf95-python3-3.8.16/lib/python3.8/posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 10, in <module>
chatbot = Chatbot({
File "/opt/venv/lib/python3.8/site-packages/revChatGPT/ChatGPT.py", line 77, in __init__
self.get_cf_cookies()
File "/opt/venv/lib/python3.8/site-packages/revChatGPT/ChatGPT.py", line 416, in get_cf_cookies
driver.quit()
UnboundLocalError: local variable 'driver' referenced before assignment
I tried using your fix, but nothing changed.
This is probably due to either
- Chrome not installed
- Chrome driver not installed
- Outdated selenium
- Outdated undetected_chromedriver
Check out https://github.com/ultrafunkamsterdam/undetected-chromedriver/issues for solutions
@ArjunSahlot I also had this error at first. @acheong08 is right, it's about chrome and driver installation. Here's what worked for me:
- Check that webdriver and google-chrome versions match. Here's a guide for webdriver version selection: https://chromedriver.chromium.org/downloads/version-selection. Basically, you need to pick a driver with the same version, as your google-chrome. To check your google-chrome version:
google-chrome --version
- Also, try to explicitly pass paths to chrome and driver executables to revChatGPT, either in code or via config file, depending on your setup. See https://github.com/acheong08/ChatGPT/wiki/Setup#config-options-optional
When I fixed this error, another one came up: "cannot connect to chrome". It is the one, described in my previous comment
Check out acheong08/ChatGPT-lite. It solves all the annoying browser problems at the cost of your privacy
I solved this problem like this:
sudo apt-get update
and then sudo apt-get --only-upgrade install google-chrome-stable