Python app with selenium help please :)

AnonymousTRIAL

a year ago

Im having an issue with chromedriver not being able to find the binary I think(?) based on the traceback

Traceback:

Traceback (most recent call last):

File "/opt/venv/lib/python3.10/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker

worker.init_process()

File "/opt/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process

self.load_wsgi()

File "/opt/venv/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi

self.wsgi = self.app.wsgi()

File "/opt/venv/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi

self.callable = self.load()

File "/opt/venv/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load

return self.load_wsgiapp()

File "/opt/venv/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp

return util.import_app(self.app_uri)

File "/opt/venv/lib/python3.10/site-packages/gunicorn/util.py", line 371, in import_app

mod = importlib.import_module(module)

File "/root/.nix-profile/lib/python3.10/importlib/__init__.py", line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "", line 1050, in _gcd_import

File "", line 1027, in _find_and_load

File "", line 1006, in _find_and_load_unlocked

File "", line 688, in _load_unlocked

File "", line 883, in exec_module

File "", line 241, in _call_with_frames_removed

File "/app/main.py", line 8, in 

generator = Generator()

File "/app/modules/generator.py", line 19, in __init__

self.driver = uc.Chrome(

File "/opt/venv/lib/python3.10/site-packages/undetected_chromedriver/__init__.py", line 372, in __init__

options.binary_location = (

File "/opt/venv/lib/python3.10/site-packages/selenium/webdriver/chromium/options.py", line 52, in binary_location

raise TypeError(self.BINARY_LOCATION_ERROR)

TypeError: Binary Location Must be a String

[2024-06-07 17:45:53 +0000] [10] [INFO] Worker exiting (pid: 10)

[2024-06-07 17:45:53 +0000] [7] [ERROR] Worker (pid:10) exited with code 3

[2024-06-07 17:45:53 +0000] [7] [ERROR] Shutting down: Master

[2024-06-07 17:45:53 +0000] [7] [ERROR] Reason: Worker failed to boot.

0 Replies

AnonymousTRIAL

a year ago

N/A


a year ago

I would highly recommend using Browserless, using it means you don't have to install Chrome and all of its needed dependencies into your container or deal with any of the issues involved in that, and this will significantly speed up both the build and the publishing stage.

Browserless template here - https://railway.app/template/browserless

And here's an example repo that shows you how to use Browserless with selenium - https://github.com/brody192/selenium-example-python


AnonymousTRIAL

a year ago

Hey! Thank you for the reply, that looks interesting I will give it a go! Thank you 🙏


AnonymousTRIAL

a year ago

Its actually undetectedChromdriver but testing now!


AnonymousTRIAL

a year ago

Okay UC does not have .Remote 😄