0

I use chrome driver during face recognition project, but I get an error in the 4th line below. How do I give permission to chromedriver.exe?

code:

data_path = '/content/drive/MyDrive/FaceRecognition/faces' 
onlyfiles = [f for f in listdir(data_path) if isfile(join(data_path,f))]
url='https://www.naver.com/' 
browser = webdriver.Chrome(r'/content/drive/MyDrive/FaceRecognition/chromedriver/chromedriver.exe')

====================================================================================================== error message:

PermissionError                           Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
     75                                             stderr=self.log_file,
---> 76                                             stdin=PIPE)
     77         except TypeError:

4 frames
PermissionError: [Errno 13] Permission denied: '/content/drive/MyDrive/FaceRecognition/chromedriver/chromedriver.exe'

During handling of the above exception, another exception occurred:

WebDriverException                        Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/selenium/webdriver/common/service.py in start(self)
     86                 raise WebDriverException(
     87                     "'%s' executable may have wrong permissions. %s" % (
---> 88                         os.path.basename(self.path), self.start_error_message)
     89                 )
     90             else:

WebDriverException: Message: 'chromedriver.exe' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

1 Answers1

1

This error message...

PermissionError: [Errno 13] Permission denied: '/content/'
.
WebDriverException: Message: '' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

...implies that the WebDriver exexutable wasn't detected and hence Selenium suspects that the executable may have wrong permissions.


Solution

While passing the Key executable_path you need to pass the absolute path of the WebDriver variant name, i.e. chromedriver as follows:

driver = webdriver.Chrome(executable_path='/content/chromedriver')
                          webdriver variant name ^^^chromedriver^^^ needs to be appended

References

You can find a couple of relevant discussions in:

C. Peck
  • 3,641
  • 3
  • 19
  • 36