From f756f523faa67b0b5cb286d5cde490efc35a83dd Mon Sep 17 00:00:00 2001 From: Carlos Herrera <66761818+HerreraCarlos81@users.noreply.github.com> Date: Sat, 5 Aug 2023 20:39:19 -0300 Subject: [PATCH] Update (fix) to __init__.py Added a try-except block on time.sleep(0.1) at line 785 which was causing errors in the implementations. --- undetected_chromedriver/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/undetected_chromedriver/__init__.py b/undetected_chromedriver/__init__.py index 2139c58..3d8b872 100644 --- a/undetected_chromedriver/__init__.py +++ b/undetected_chromedriver/__init__.py @@ -782,7 +782,10 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver): else: logger.debug("successfully removed %s" % self.user_data_dir) break - time.sleep(0.1) + try: + time.sleep(0.1) + except OSError: + pass # dereference patcher, so patcher can start cleaning up as well. # this must come last, otherwise it will throw 'in use' errors