splinter icon indicating copy to clipboard operation
splinter copied to clipboard

ValueError: I/O operation on closed file

Open sureshvv opened this issue 2 years ago • 3 comments

This error comes from:

path = os.path.join(os.path.dirname(file), 'bin', 'chromedriver') service = Service(executable_path=path) browser = Browser('chrome', service=service, headless=True)

ValueError: I/O operation on closed file

Traceback (most recent call last): File "/home/ubuntu/splinter/download2.py", line 73, in get_periods browser = Browser('chrome', service=service, headless=True) File "/home/ubuntu/splinter/lib/python3.10/site-packages/splinter/browser.py", line 130, in Browser return get_driver(driver, retry_count=retry_count, config=config, *args, **kwargs) File "/home/ubuntu/splinter/lib/python3.10/site-packages/splinter/browser.py", line 92, in get_driver return driver(config=config, *args, **kwargs) File "/home/ubuntu/splinter/lib/python3.10/site-packages/splinter/driver/webdriver/chrome.py", line 65, in init driver = _setup_chrome( File "/home/ubuntu/splinter/lib/python3.10/site-packages/splinter/driver/webdriver/setup.py", line 36, in _setup_chrome rv = driver_class(options=options, service=service, **kwargs) File "/home/ubuntu/splinter/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in init super().init( File "/home/ubuntu/splinter/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 53, in init self.service.start() File "/home/ubuntu/splinter/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 98, in start self._start_process(self._path) File "/home/ubuntu/splinter/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 205, in _start_process self.process = subprocess.Popen( File "/usr/lib/python3.10/subprocess.py", line 837, in init errread, errwrite) = self._get_handles(stdin, stdout, stderr) File "/usr/lib/python3.10/subprocess.py", line 1638, in _get_handles c2pwrite = stdout.fileno() ValueError: I/O operation on closed file

splinter version: 0.20.1 selenium version: 4.15.2 ChromeDriver 120.0.6099.62

sureshvv avatar Dec 06 '23 08:12 sureshvv

We're seeing the same error with:

splinter version: 0.19.1 selenium version: 4.14.0 ChromeDriver 119.0.6045.105

anewbigging-trialgrid avatar Dec 15 '23 07:12 anewbigging-trialgrid

I can't reproduce this using:

  • splinter 0.21.0

  • selenium 4.17.2

  • chromedriver 121.0.6167.85

javascript-error avatar Feb 12 '24 22:02 javascript-error

Workaround was:

    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument('--headless')
    browser = Browser('chrome', options=chrome_options, headless=True)

Seems to work

sureshvv avatar Feb 13 '24 16:02 sureshvv