jaspreet sohal
jaspreet sohal

Reputation: 37

IOError: [Errno 30] Read-only file system: 'geckodriver.log'

I am trying to run a python script by clicking a button on HTML page. Python script uses Selenium Firefox driver to perform some tasks. The script works well when I run it from command prompt but when I try to run it through webpage withing the application. It gives the following error.

  File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\runtime\stubs.py", line 278, in __init__
    raise IOError(errno.EROFS, 'Read-only file system', filename)
IOError: [Errno 30] Read-only file system: 'geckodriver.log'

I am using Google App Engine's webapp2 framework and python 2.7

I tried to googling it but couldn't find anything. Any suggestions please, how can I solve this bug.

Upvotes: 1

Views: 4589

Answers (3)

Yaser Sakkaf
Yaser Sakkaf

Reputation: 153

I solved the issue by disabling the logs in the following way:

driver = webdriver.Firefox(service_log_path='/dev/null')

Upvotes: 1

MarcosBernal
MarcosBernal

Reputation: 602

As others have commented, the problem is a lack of permissions in the current path.

However, the log can be stored either inside the /tmp folder [1] or using /dev/null. It can be done with this python lines:

from selenium import webdriver

your_executable_path = "/tmp/geckodriver"
# Or using webdriver_manager [2]
# from webdriver_manager.firefox import GeckoDriverManager
# your_executable_path = GeckoDriverManager(path="/tmp").install()
driver = webdriver.Firefox(executable_path=your_executable_path, log_path='/tmp/geckodriver.log')
driver.get('http://www.google.com/')

Keep in mind that it is required to have installed the browser into the system. [3]

Upvotes: 3

Venantius
Venantius

Reputation: 2539

As others have noted, App Engine applications are run in a sandboxed environment. One of those sandbox conditions is that you are not permitted to modify the filesystem.

In normal circumstances, you can get around this by configuring Selenium to write the logs to /dev/null by setting the BROWSER_LOGFILE environment variable to /dev/null. I'm not sure if that'll run into the same filesystem issues, but it's probably worth a shot.

Upvotes: 2

Related Questions