Permission denied: 'geckodriver.log' while running selenium webdriver in python

Apparently this can come from an incompatibility between your firefox and your Selenium. Try pip install --upgrade selenium, and if the error is still there, try downloading a different version of Firefox, or of the gecko driver.

Regarding the message:

'geckodriver' executable needs to be in PATH

You could set the path of the driver on the script:

ff_profile_dir = "/usr/local/selenium/webdriver/firefox"
ff_profile = selenium.webdriver.FirefoxProfile(profile_directory=ff_profile_dir)
driver = selenium.webdriver.Firefox(ff_profile)

Or, according to this answer, you could run, on Unix systems, on a bash-compatible shell:

export PATH=$PATH:/path/to/directory/of/executable/downloaded/in/previous/step

On Windows you will need to update the Path system variable to add the full directory path to the executable geckodriver manually or command line(don't forget to restart your system after adding executable geckodriver into system PATH to take effect). The principle is the same as on Unix.


I was having the same problem. I tried using Ivan Chaer's answer, but it didn't work. I tried a whole bunch of other things until I finally came across a working solution. All the time I had been trying to run Selenium, I had been using the interactive shell. When I tried putting the code in a script and then running it instead, everything worked fine.

I then noticed that a file named "geckodriver.log" had been created in the same directory as the script. That gave me an idea. I created a "geckodriver.log" file in C:\Program Files\Python36 and then using Selenium with Firefox no longer threw any errors.


I had this same issue recently on a Windows 10 workstation. I fixed it by explicitly setting the service_log_path to a location I know I've got write access to:

browser = webdriver.Firefox( service_log_path="C:\\Users\\[username]\\AppData\\Local\\Temp\\geckodriver.log" )