Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot retrieve data for multiurl raised unreleated error #54

Open
Bing1996 opened this issue Nov 7, 2024 · 0 comments
Open

Cannot retrieve data for multiurl raised unreleated error #54

Bing1996 opened this issue Nov 7, 2024 · 0 comments

Comments

@Bing1996
Copy link

Bing1996 commented Nov 7, 2024

demo code is used from code

from ecmwf.opendata import Client

client = Client()

client.retrieve(
    step=240,
    type="fc",
    param="msl",
    target="data.grib2",
)

it returns whatever I changed my code:

Traceback (most recent call last):
  File "/home/shengbin/github/testx/main.py", line 5, in <module>
    client.retrieve(
  File "/home/shengbin/github/testx/.venv/lib/python3.12/site-packages/ecmwf/opendata/client.py", line 147, in retrieve
    result.size = download(
                  ^^^^^^^^^
  File "/home/shengbin/github/testx/.venv/lib/python3.12/site-packages/multiurl/downloader.py", line 111, in download
    return Downloader(url, **kwargs).download(target)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/shengbin/github/testx/.venv/lib/python3.12/site-packages/multiurl/base.py", line 126, in download
    desc=self.title(),
         ^^^^^^^^^^^^
  File "/home/shengbin/github/testx/.venv/lib/python3.12/site-packages/multiurl/http.py", line 126, in title
    return params["filename"]
           ~~~~~~^^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'

And my pip venv only install ecmwf-opendate, and it's the same error for my other production code. It seems about ecmwf opendata server internal error, but it raised the TypeError. The more odd thing is the code mentioned above still can work yesterday.

andir added a commit to andir/multiurl that referenced this issue Nov 9, 2024
This should resolve ecmwf#21 which should also solve
ecmwf/ecmwf-opendata#54.

The parsing function returns a dictionary, not a tuple. If we
tuple-unpack a dictionary, that will give us the keys of the *first
two* dictionary entries. If there are more than two entries it would
raise a ValueError (too many values to unpack).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant