-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting Authentication Failure (cannot access local variable 'driver' where it is not associated with a value) #116
Comments
Same error also happens running in docker |
Workaround is to upgrade Chrome (google-chrome-stable). Here's how I did it in docker:
BEFORE:
AFTER:
|
Since the dockerfile doesn't pin package versions, presumably the docker image just needs to be rebuilt and the apt command will pull the later version of the package... Edit: This will rebuild you a new working docker container and tag it: Then you can run the freshly built localsafeway:latest image you just created. Edit2: for future reference for those not as familiar with docker, to cleanup once the main package is updated and you want to delete the local version you just built you can run this to remove and untag the image you created: |
Thanks guys for the local fix, it does work and I updated to use the localsafeway image. |
Not working for me. Current driver version: |
Try in your docker-compose.yaml to change the line: |
Should have been more verbose. I've been cloning the repo, main branch, and building and running it from the locally built version. I do get some build errors when I do the process as you've described but I don't think that matters so much since cloning the repo and building it is effectively the same thing, unless I'm mistaken. |
For those of you using Docker Compose and using the hosted image you can temporarily add the following to get the image updated before
|
I also the method suggested by @tuxthepenguin84 As far as I can tell the chrome debugger doesn't open the listening port. `netstat -lnp `Clipping coupons for Safeway account redacted@redacted.com Safeway account: redacted@redacted.com During handling of the above exception, another exception occurred: Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
I had multiple issues. One of which was PID limits causing the process to not be able to spawn. The recommended solution to build the project locally and deploy that image did end up resolve the base issue. |
Rebuilding like @jvasa mentioned #116 (comment) fixed the issue. |
following @jvasa suggestion in #116 (comment) also fixed it for me (it should also fix #115). originally i was using v0.2.12 and getting this error when i exec'd into the container to run it manually:
when you build from scratch instead of using the prebuilt container, you get a new version of ChromeDriver. since this seems to be a recurring issue, would it make sense to factor out the ChromeDriver install and make it so that it can be upgraded without touching the rest of the safeway-coupon's code? Would it be possible to make a container that keeps ChromeDriver up to date, saving it into a volume that can also be mounted/shared into safeway-coupons container? That way we wouldn't have to rebuild everything from scratch every time. apparently there's some auto updaters like these: https://stackoverflow.com/questions/66018451/how-to-get-the-chromedriver-automatically-updated-through-python-selenium-after but i dont know if these will fit our use case. let me know if i'm on the right track, the next time this breaks, i'll try to automate it. |
This is how I fixed it and setup a connection to the SMTP email account I use:
I have a wrapper script to use |
Getting this error:
Error: Authentication Failure (cannot access local variable 'driver' where it is not associated with a value)
<<<<<<
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/session.py", line 69, in _chrome_driver
with chrome_driver(headless=headless) as driver:
File "/usr/local/lib/python3.12/contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/chrome_driver.py", line 38, in chrome_driver
driver = uc.Chrome(options=options)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/undetected_chromedriver/init.py", line 466, in init
super(Chrome, self).init(
File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in init
super().init(
File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 61, in init
super().init(command_executor=executor, options=options)
File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 208, in init
self.start_session(capabilities)
File "/usr/local/lib/python3.12/site-packages/undetected_chromedriver/init.py", line 724, in start_session
super(selenium.webdriver.chrome.webdriver.WebDriver, self).start_session(
File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 292, in start_session
response = self.execute(Command.NEW_SESSION, caps)["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:60161
from session not created: This version of ChromeDriver only supports Chrome version 123
Current browser version is 122.0.6261.94
Stacktrace:
#0 0x556b10a59993
#1 0x556b10754136
#2 0x556b1078e3bb
#3 0x556b1078d585
#4 0x556b10783ebb
#5 0x556b107cd239
#6 0x556b107c0a73
#7 0x556b10791c93
#8 0x556b1079265e
#9 0x556b10a1e08b
#10 0x556b10a22005
#11 0x556b10a0c491
#12 0x556b10a22b92
#13 0x556b109f19ef
#14 0x556b10a48df8
#15 0x556b10a48fcb
#16 0x556b10a58ae4
#17 0x7fafa5a8a134
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/session.py", line 58, in init
self._login(account)
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/session.py", line 95, in _login
with self._chrome_driver() as driver:
File "/usr/local/lib/python3.12/contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/session.py", line 76, in _chrome_driver
driver.save_screenshot(path)
^^^^^^
UnboundLocalError: cannot access local variable 'driver' where it is not associated with a value
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/safeway-coupons", line 8, in
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/app.py", line 125, in main
sc.clip_for_account(account)
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/safeway.py", line 38, in clip_for_account
swy = SafewayClient(account, self.debug_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/client.py", line 17, in init
self.session = LoginSession(account, debug_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/safeway_coupons/session.py", line 64, in init
raise AuthenticationFailure(e, account) from e
safeway_coupons.errors.AuthenticationFailure: Authentication Failure (cannot access local variable 'driver' where it is not associated with a value)
The text was updated successfully, but these errors were encountered: