0

Hi I'm using undetected_chromedriver in my python script, but about a month ago I ran into a problem. It was working fine, until one day the script displayed this error


Traceback (most recent call last):
  File "D:\New folder\main.py", line 3, in <module>
    driver = uc.Chrome()
             ^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\__init__.py", line 240, in __init__
    patcher.auto()
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\patcher.py", line 127, in auto
    release = self.fetch_release_number()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\patcher.py", line 148, in fetch_release_number
    return LooseVersion(urlopen(self.url_repo + path).read().decode())
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 216, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 519, in open
    response = self._open(req, data)
               ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 536, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 496, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 1391, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\urllib\request.py", line 1317, in do_open
    h = http_class(host, timeout=req.timeout, **http_conn_args)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 1421, in __init__
    context = ssl._create_default_https_context()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 777, in create_default_context
    context.load_default_certs(purpose)
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 598, in load_default_certs
    self._load_windows_store_certs(storename, purpose)
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 588, in _load_windows_store_certs
    self.load_verify_locations(cadata=certs)
ssl.SSLError: [ASN1] nested asn1 error (_ssl.c:4004)
Exception ignored in: <function Patcher.__del__ at 0x000002D63A314400>
Traceback (most recent call last):
  File "C:\Users\micko\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_chromedriver\patcher.py", line 273, in __del__
    time.sleep(0.1)
OSError: [WinError 6] The handle is invalid

I'm using the script they provided

import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://nowsecure.nl')

I tried different python versions, but that didn't work either. No idea what could cause the problem.

Maksa MM
  • 1
  • 1

1 Answers1

0

Use driver = uc.Chrome(use_subprocess=True) instead of driver = uc.Chrome()

Flawed
  • 11
  • 2