You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, if -O mode is invoked by Python, optimization will not execute assert line, making variable content undeclared, hence return statement will raise error.
What are the steps to reproduce the bug?
execute script using cdsapi with python -O
Version
0.7.2-0.7.4
Platform (OS and architecture)
OS Independent
Relevant log output
[vscode@d9e105258f04 daily-era5-downloader]$ python -O handler.py
Downloading files for the following times: ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']
/opt/conda/lib/python3.12/site-packages/cads_api_client/api_client.py:83: UserWarning: cannot access local variable 'content' where it is not associated with a value
warnings.warn(str(exc), UserWarning)
Traceback (most recent call last):
....... <intentionally hide>.....
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/legacy_api_client.py", line 169, in retrieve
submitted = self.client.submit_and_wait_on_results(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/api_client.py", line 458, in submit_and_wait_on_results
return self._retrieve_api.submit(collection_id, **request).make_results()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/processing.py", line 743, in submit
return self.get_process(collection_id).submit(**request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/processing.py", line 732, in get_process
return Process.from_request("get", url, **self._request_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/processing.py", line 191, in from_request
self.log_messages()
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/processing.py", line 215, in log_messages
if message_str := self._json_dict.get("message"):
^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/cads_api_client/processing.py", line 207, in _json_dict
return content
^^^^^^^
UnboundLocalError: cannot access local variable 'content' where it is not associated with a value
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered:
What happened?
In cdsapi 0.7.4, its dependency cads-api-client has a faulty statement in file
process.py:204
. It writes asHowever, if -O mode is invoked by Python, optimization will not execute assert line, making variable
content
undeclared, hence return statement will raise error.What are the steps to reproduce the bug?
execute script using cdsapi with
python -O
Version
0.7.2-0.7.4
Platform (OS and architecture)
OS Independent
Relevant log output
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered: