Fixed win 6 error when time.sleep(0.1)
This commit is contained in:
parent
bf7dcf8b57
commit
3a1b860866
|
@ -740,7 +740,13 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
|
||||||
else:
|
else:
|
||||||
logger.debug("successfully removed %s" % self.user_data_dir)
|
logger.debug("successfully removed %s" % self.user_data_dir)
|
||||||
break
|
break
|
||||||
|
try:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
except (RuntimeError, OSError, PermissionError) as e:
|
||||||
|
logger.debug(
|
||||||
|
"When trying 'time.sleep(0.1)', a %s occured: %s\nretrying..."
|
||||||
|
% (e.__class__.__name__, e)
|
||||||
|
)
|
||||||
|
|
||||||
# dereference patcher, so patcher can start cleaning up as well.
|
# dereference patcher, so patcher can start cleaning up as well.
|
||||||
# this must come last, otherwise it will throw 'in use' errors
|
# this must come last, otherwise it will throw 'in use' errors
|
||||||
|
|
|
@ -12,6 +12,8 @@ from typing import Callable
|
||||||
from typing import List
|
from typing import List
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
logger = logging.getLogger("uc")
|
||||||
|
logger.setLevel(logging.getLogger().getEffectiveLevel())
|
||||||
|
|
||||||
class Structure(dict):
|
class Structure(dict):
|
||||||
"""
|
"""
|
||||||
|
@ -162,7 +164,13 @@ def test():
|
||||||
"func called! %s (args: %s, kwargs: %s)" % (fn.__name__, args, kwargs)
|
"func called! %s (args: %s, kwargs: %s)" % (fn.__name__, args, kwargs)
|
||||||
)
|
)
|
||||||
while driver.service.process and driver.service.process.poll() is not None:
|
while driver.service.process and driver.service.process.poll() is not None:
|
||||||
|
try:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
except (RuntimeError, OSError, PermissionError) as e:
|
||||||
|
logger.debug(
|
||||||
|
"When trying 'time.sleep(0.1)', a %s occured: %s\nretrying..."
|
||||||
|
% (e.__class__.__name__, e)
|
||||||
|
)
|
||||||
res = fn(*args, **kwargs)
|
res = fn(*args, **kwargs)
|
||||||
print("func completed! (result: %s)" % res)
|
print("func completed! (result: %s)" % res)
|
||||||
return res
|
return res
|
||||||
|
|
|
@ -268,8 +268,11 @@ class Patcher(object):
|
||||||
os.unlink(self.executable_path)
|
os.unlink(self.executable_path)
|
||||||
logger.debug("successfully unlinked %s" % self.executable_path)
|
logger.debug("successfully unlinked %s" % self.executable_path)
|
||||||
break
|
break
|
||||||
except (OSError, RuntimeError, PermissionError):
|
except (OSError, RuntimeError, PermissionError) as e:
|
||||||
time.sleep(0.1)
|
logger.debug(
|
||||||
|
"When trying 'time.sleep(0.1)', a %s occured: %s\nretrying..."
|
||||||
|
% (e.__class__.__name__, e)
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue