R
Railwayβ€’5mo ago
Kylie Jenner

Python app with selenium help please :)

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 "<frozen importlib._bootstrap>", line 1050, in _gcd_import

File "<frozen importlib._bootstrap>", line 1027, in _find_and_load

File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 688, in _load_unlocked

File "<frozen importlib._bootstrap_external>", line 883, in exec_module

File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed

File "/app/main.py", line 8, in <module>

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.
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 "<frozen importlib._bootstrap>", line 1050, in _gcd_import

File "<frozen importlib._bootstrap>", line 1027, in _find_and_load

File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked

File "<frozen importlib._bootstrap>", line 688, in _load_unlocked

File "<frozen importlib._bootstrap_external>", line 883, in exec_module

File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed

File "/app/main.py", line 8, in <module>

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.
Solution:
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...
GitHub
GitHub - brody192/selenium-example-python
Contribute to brody192/selenium-example-python development by creating an account on GitHub.
Jump to solution
4 Replies
Percy
Percyβ€’5mo ago
Project ID: N/A
Kylie Jenner
Kylie Jennerβ€’5mo ago
N/A
Solution
Brody
Brodyβ€’5mo 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
GitHub
GitHub - brody192/selenium-example-python
Contribute to brody192/selenium-example-python development by creating an account on GitHub.
Kylie Jenner
Kylie Jennerβ€’5mo ago
Hey! Thank you for the reply, that looks interesting I will give it a go! Thank you πŸ™ Its actually undetectedChromdriver but testing now! Okay UC does not have .Remote πŸ˜„
Want results from more Discord servers?
Add your server