splinter icon indicating copy to clipboard operation
splinter copied to clipboard

local variable 'e' referenced before assignment in DriverNotFoundError

Open alphydan opened this issue 6 years ago • 4 comments

I am trying to run a simple:

from splinter import Browser
browser = Browser('chrome', **executable_path)

I have downloaded the latest chromedriver from https://chromedriver.chromium.org/, I did chmod +x the driver, saved it to the working directory and defined the executable_path as:

executable_path = {'executable_path': os.getcwd() + '/chromedriver'}

However, I get the error:


UnboundLocalError                         Traceback (most recent call last)
<ipython-input-13-92a2d755a7ca> in <module>
      1 from splinter import Browser
----> 2 browser = Browser('chrome', **executable_path)

~/.local/share/virtualenvs/some-app-Aojajyp7/lib/python3.6/site-packages/splinter/browser.py in Browser(driver_name, retry_count, *args, **kwargs)
     88         raise DriverNotFoundError("No driver for %s" % driver_name)
     89 
---> 90     return get_driver(driver, *args, **kwargs)

~/.local/share/virtualenvs/some-app-Aojajyp7/lib/python3.6/site-packages/splinter/browser.py in get_driver(driver, retry_count, *args, **kwargs)
     66             pass
     67 
---> 68     raise e
     69 
     70 

UnboundLocalError: local variable 'e' referenced before assignment

alphydan avatar Dec 20 '19 21:12 alphydan

@andrewsmedina I have a fix for this, will open a PR tomorrow.

javascript-error avatar Dec 21 '19 03:12 javascript-error

closed by #749

andrewsmedina avatar Dec 24 '19 20:12 andrewsmedina

When the patch release?

nmfzone avatar Dec 26 '19 12:12 nmfzone

@andrewsmedina could we please get a new release containing this fix?

I'd like to be able to automatically install the necessary WebDriver using https://github.com/SergeyPirogov/webdriver_manager, but the UnboundLocalError causes Splinter to crash too early to detect which drivers are available.

jacebrowning avatar Mar 26 '20 03:03 jacebrowning