ImportError: sys.meta_path is None, Python is likely shutting down ImportError: sys.meta_path is None, Python is likely shutting down selenium selenium

ImportError: sys.meta_path is None, Python is likely shutting down


I've reproduced the same error using Python 3.6, Selenium 3.0.2 and ChromeDriver 2.27 (everything latest at this point).

The problem appears to happen when the Python selenium webdriver tries to stop the chromedriver service either when you explicitly close the driver, or when the script execution simply ends (and the __del__ method gets to be executed).

Reported the issue to Python/Selenium github issue tracker:

Workaround:

I found that using driver.quit() instead of driver.close() helps to workaround the problem.


you can also give time for the quit method to finish execution before python exit.this worked for me :

#right before quittingdriver.quit()time.sleep(1)


I have hit the same issue while working on CLI Automation project.

To get rid of this, you have to close the opened objects such as:

  1. If working on Paramiko, have to close the opened handlersclient.close()shell.close()
  2. If working on file operations then file_handler.close()
  3. if working on sockets then we have close the objects created on it.