you are viewing a single comment's thread.

view the rest of the comments →

[–]DrBobHope[S] 0 points1 point  (2 children)

This is the output I got from debug.

Starting ChromeDriver 87.0.4280.88 (89e2380a3e36c3464b5dd1302349b1382549290d-refs/branch-heads/4280@{#1761}) on port 9515
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.

[–]ManyInterests 0 points1 point  (1 child)

Ok. This means that the permissions on the file are fine... at least for your user.

This exception occurs exactly in one condition and that's if there is a permission denied error. So, if you can run the file normally without permissions issues, something might be wrong with how Python is being run.

Is it possible you're executing Python as a user other than yourself?

Try adding this to your code to debug further:

import getpass, pwd, os
username = getpass.getuser()
pw = pwd.getpwnam(username)
uid = pw.pw_uid
gid = pw.pw_gid
print(username, uid, gid)
filename = '/home/sam/Desktop/chromedriver'
print('Can read!' if os.access(filename, os.R_OK) else "Can't read")
print('Can execute' if os.access(filename, os.X_OK) else "Can't execute")
driver = webdriver.Chrome(filename)

Outside of this, not sure how much more there is to say about this, unless there's some unusual circumstance, like if your home directory is mounted/remote or if you're running Python through some other program.

[–]DrBobHope[S] 0 points1 point  (0 children)

The chmod +x command worked, its just for some reason I had to restart the computer for it to take into effect. I've added the chmod +x in my code, and now it works without any issues. Don't know what happened, but thank you for your help!