ImportError: sys.meta_path - None, Python probably disconnects

Newby is here. Please explain why this problem occurred and how to fix it.

Error:

"C: \ Program Files (x86) \ Python36-32 \ python.exe" C: /Users/Vivek-Pc/PycharmProjects/tryOutSeries/searchTryout2.py The exception is ignored in:> Traceback (last last call): File "C: \ Program Files (x86) \ Python36-32 \ lib \ site-packages \ selenium \ webdriver \ common \ service.py ", line 173, in del File" C: \ Program Files (x86) \ Python36-32 \ lib \ site-packages \ selenium \ webdriver \ common \ service.py ", line 149, in stop mode File" C: \ Program Files (x86) \ Python36-32 \ lib \ site-packages \ selenium \ webdriver \ common \ service. py ", line 120, in send_remote_shutdown_command ImportError: sys.meta_path - None, Python probably shuts down. Process terminated with exit code 0

Used code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver_path = "c:\Program Files (x86)\Python36-32\Lib\site-packages\selenium\webdriver\chrome\chromedriver"
b_obj = webdriver.Chrome(driver_path)
b_obj.implicitly_wait(15)
b_obj.maximize_window()
b_obj.get('http://stackoverflow.com/')

search_box = b_obj.find_element_by_name('q')
search_box.clear()
search_box.send_keys("Selenium")
search_box.submit()
b_obj.close()

Environment Information:

Windows, Selenium, Python, Chrome (chromedriver.exe) and PyCharm

+4
4

, Python 3.6, Selenium 3.0.2 ChromeDriver 2.27 ( ).

, - Pelon selenium chromedriver script ( __del__ ).

Python/Selenium github:

:

, driver.quit() driver.close() .

+8

, CLI.

, , :

  1. Paramiko, client.close() shell.close()
  2. , file_handler.close()
  3. , , .
0

You can also give time for the quit method to complete execution before exiting Python. this worked for me:

#right before quitting
driver.quit()
time.sleep(1)
0
source

Source: https://habr.com/ru/post/1665839/


All Articles