ARTICLE AD BOX
I wanted some functionality from python2 so I downloaded the source for version 2.7.18, compiled and installed it on my 64-bit opensuse pc last week.
Some software(mpv and yt-dlp) began to misbehave so I uninstalled python2. I updated as many python3 packages as I could and also reinstalled mpv. mpv now works but yt-dlp still doesn't. The problem seems to be related to DNS resolution.
What system libraries does python3 use to resolve domain names. I believe if I can reinstall those perhaps things will start working again. Am I wrong? What steps would you take to fix the problem?
I've used the requests library to create a reproducible example. The output from a REPL session is shown below:
>>> import requests >>> >>> >>> r = requests.get('https://api.github.com/events') Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/urllib3/connection.py", line 198, in _new_conn sock = connection.create_connection( (self._dns_host, self.port), ...<2 lines>... socket_options=self.socket_options, ) File "/usr/lib/python3.13/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/usr/lib/python3.13/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ~~~~~~~~~~~~^^^^ TimeoutError: [Errno 110] Connection timed out The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/urllib3/connectionpool.py", line 787, in urlopen response = self._make_request( conn, ...<10 lines>... **response_kw, ) File "/usr/lib/python3.13/site-packages/urllib3/connectionpool.py", line 488, in _make_request raise new_e File "/usr/lib/python3.13/site-packages/urllib3/connectionpool.py", line 464, in _make_request self._validate_conn(conn) ~~~~~~~~~~~~~~~~~~~^^^^^^ File "/usr/lib/python3.13/site-packages/urllib3/connectionpool.py", line 1093, in _validate_conn conn.connect() ~~~~~~~~~~~~^^ File "/usr/lib/python3.13/site-packages/urllib3/connection.py", line 753, in connect self.sock = sock = self._new_conn() ~~~~~~~~~~~~~~^^ File "/usr/lib/python3.13/site-packages/urllib3/connection.py", line 207, in _new_conn raise ConnectTimeoutError( ...<2 lines>... ) from e urllib3.exceptions.ConnectTimeoutError: (<urllib3.connection.HTTPSConnection object at 0x7f5d14413380>, 'Connection to api.github.com timed out. (connect timeout=None)') The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.13/site-packages/requests/adapters.py", line 644, in send resp = conn.urlopen( method=request.method, ...<9 lines>... chunked=chunked, ) File "/usr/lib/python3.13/site-packages/urllib3/connectionpool.py", line 841, in urlopen retries = retries.increment( method, url, error=new_e, _pool=self, _stacktrace=sys.exc_info()[2] ) File "/usr/lib/python3.13/site-packages/urllib3/util/retry.py", line 519, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /events (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f5d14413380>, 'Connection to api.github.com timed out. (connect timeout=None)')) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<python-input-3>", line 1, in <module> r = requests.get('https://api.github.com/events') File "/usr/lib/python3.13/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) File "/usr/lib/python3.13/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python3.13/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "/usr/lib/python3.13/site-packages/requests/adapters.py", line 665, in send raise ConnectTimeout(e, request=request) requests.exceptions.ConnectTimeout: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /events (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f5d14413380>, 'Connection to api.github.com timed out. (connect timeout=None)'))