-
Notifications
You must be signed in to change notification settings - Fork 65
Description
What happened?
I met this problem couple of days ago (20.10.2025 20:49 UTC) using code that I frequently use and which has been working with no problems in hundreds of downloads. I am downloading "ERA5 hourly data on single levels from 1940 to present" and got the following error message (attached file). As you can see, it downloaded one month with no problem but crashed on the second month. I made another attempt but the same thing happened.
The python function using cdsapi is on another attached file. I cannot provide the full code because of confidentiality, apologies. I hope these 2 extracted functions sl_download() and getdata_sl() are enough. The getdata_sl() downloads one month at a time.
I have a similar setup to download model layer files "Complete ERA5 global atmospheric reanalysis" and it gives very similar error message. As with single layer case, this code has been working flawlessly literally hundreds of times.
Please let me know what further information I can provide. The timestamps are UTC+3.
What are the steps to reproduce the bug?
This bug is not entirely reproducible: it downloads few months with no problem and then randomly crashes.
cds_run_2025-10-20_2342.txt
getdata_sl_extracted.py
Version
cdsapi==0.7.5
Platform (OS and architecture)
Microsoft Windows 10 Pro Version 10.0.19045 Build 19045
Relevant log output
Downloading 01 2014
2025-10-20 23:42:21,335 INFO Request ID is 2c224733-3850-4498-9441-00767ecae5c4
2025-10-20 23:42:21,424 INFO status has been updated to accepted
2025-10-20 23:42:42,775 INFO status has been updated to running
2025-10-20 23:48:55,703 INFO status has been updated to successful
One month downloaded 6.64 min
Downloading 02 2014
2025-10-20 23:48:57,956 INFO Request ID is 12f9d499-acd8-40cf-a320-0aa2e2a810e6
2025-10-20 23:48:58,027 INFO status has been updated to accepted
2025-10-20 23:49:11,694 INFO status has been updated to running
Traceback (most recent call last):
File "C:\Program Files\Python313\Lib\site-packages\urllib3\connectionpool.py", line 464, in _make_request
self._validate_conn(conn)
~~~~~~~~~~~~~~~~~~~^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\urllib3\connectionpool.py", line 1093, in _validate_conn
conn.connect()
~~~~~~~~~~~~^^
File "C:\Program Files\Python313\Lib\site-packages\urllib3\connection.py", line 741, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
sock=sock,
...<14 lines>...
assert_fingerprint=self.assert_fingerprint,
)
File "C:\Program Files\Python313\Lib\site-packages\urllib3\connection.py", line 920, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
sock=sock,
...<8 lines>...
tls_in_tls=tls_in_tls,
)
File "C:\Program Files\Python313\Lib\site-packages\urllib3\util\ssl_.py", line 460, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "C:\Program Files\Python313\Lib\site-packages\urllib3\util\ssl_.py", line 504, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\ssl.py", line 455, in wrap_socket
return self.sslsocket_class._create(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
sock=sock,
^^^^^^^^^^
...<5 lines>...
session=session
^^^^^^^^^^^^^^^
)
^
File "C:\Program Files\Python313\Lib\ssl.py", line 1076, in _create
self.do_handshake()
~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\Python313\Lib\ssl.py", line 1372, in do_handshake
self._sslobj.do_handshake()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLEOFError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1028)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\Python313\Lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
response = self._make_request(
conn,
...<10 lines>...
**response_kw,
)
File "C:\Program Files\Python313\Lib\site-packages\urllib3\connectionpool.py", line 488, in _make_request
raise new_e
urllib3.exceptions.SSLError: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1028)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Program Files\Python313\Lib\site-packages\requests\adapters.py", line 667, in send
resp = conn.urlopen(
method=request.method,
...<9 lines>...
chunked=chunked,
)
File "C:\Program Files\Python313\Lib\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 "C:\Program Files\Python313\Lib\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='cds.climate.copernicus.eu', port=443): Max retries exceeded with url: /api/retrieve/v1/jobs/12f9d499-acd8-40cf-a320-0aa2e2a810e6?log=True&request=True (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1028)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
getdata_sl(year, mm, days, area, param, outfullnamezip, testing)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<path removed>\era5cds.py", line 95, in getdata_sl
r = c.retrieve('reanalysis-era5-single-levels', {
'variable' : param,
...<17 lines>...
'data_format' : 'netcdf'
})
File "C:\Program Files\Python313\Lib\site-packages\datapi\legacy_api_client.py", line 169, in retrieve
submitted = self.client.submit_and_wait_on_results(
collection_id=name,
request=request,
)
File "C:\Program Files\Python313\Lib\site-packages\datapi\api_client.py", line 413, in submit_and_wait_on_results
return self._retrieve_api.submit(collection_id, request).make_results()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 489, in make_results
self._wait_on_results()
~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 467, in _wait_on_results
while not self.results_ready:
^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 475, in results_ready
status = self.status
^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 439, in status
reply = self.json
^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 424, in json
return self._get_api_response("get", params=params)._json_dict
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 409, in _get_api_response
return ApiResponse.from_request(
~~~~~~~~~~~~~~~~~~~~~~~~^
method, self.url, **self._request_kwargs, **kwargs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\Program Files\Python313\Lib\site-packages\datapi\processing.py", line 172, in from_request
response = robust_request(
method, url, headers=headers, **request_options, **kwargs
)
File "C:\Program Files\Python313\Lib\site-packages\multiurl\http.py", line 479, in wrapped
r = call(main_url, *args, **kwargs)
File "C:\Program Files\Python313\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "C:\Program Files\Python313\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "C:\Program Files\Python313\Lib\site-packages\requests\adapters.py", line 698, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='cds.climate.copernicus.eu', port=443): Max retries exceeded with url: /api/retrieve/v1/jobs/12f9d499-acd8-40cf-a320-0aa2e2a810e6?log=True&request=True (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1028)')))Accompanying data
No response
Organisation
No response