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

Incorrect error message when some but not all readers found #1201

Closed
gerritholl opened this issue May 12, 2020 · 0 comments · Fixed by #1202
Closed

Incorrect error message when some but not all readers found #1201

gerritholl opened this issue May 12, 2020 · 0 comments · Fixed by #1202
Labels

Comments

@gerritholl
Copy link
Collaborator

Describe the bug

When creating a Scene object with multiple readers, and one or more of the readers are not found, the exception lists all requested readers as not found. This is confusing.

To Reproduce

import glob
from satpy import Scene
fn_sev = glob.glob("/media/nas/x21308/scratch/SEVIRI/2013/12/12/*")
fn_nok = ["/grapefruit/not/found"]
reader_sev = "seviri_l1b_hrit"
reader_nok = "fruit-reader"
sc = Scene(filenames={reader_sev: fn_sev})  # ok
sc = Scene(filenames={reader_sev: fn_sev, reader_nok: fn_nok})

Expected behavior

I expect the exception:

Traceback (most recent call last):
  File "mwe46.py", line 8, in <module>
    sc = Scene(filenames={reader_sev: fn_sev, reader_nok: fn_nok})
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/scene.py", line 149, in __init__
    self.readers = self.create_reader_instances(filenames=filenames,
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/scene.py", line 193, in create_reader_instances
    return load_readers(filenames=filenames,
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/readers/__init__.py", line 706, in load_readers
    for idx, reader_configs in enumerate(configs_for_reader(reader, ppp_config_dir)):
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/readers/__init__.py", line 552, in configs_for_reader
    raise ValueError("No reader(s) named: {}".format(reader))
ValueError: No reader(s) named: ['fruit-reader']

Actual results

In reality I get the exception:

Traceback (most recent call last):
  File "mwe46.py", line 8, in <module>
    sc = Scene(filenames={reader_sev: fn_sev, reader_nok: fn_nok})
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/scene.py", line 149, in __init__
    self.readers = self.create_reader_instances(filenames=filenames,
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/scene.py", line 193, in create_reader_instances
    return load_readers(filenames=filenames,
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/readers/__init__.py", line 706, in load_readers
    for idx, reader_configs in enumerate(configs_for_reader(reader, ppp_config_dir)):
  File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/satpy/readers/__init__.py", line 552, in configs_for_reader
    raise ValueError("No reader(s) named: {}".format(reader))
ValueError: No reader(s) named: ['seviri_l1b_hrit', 'fruit-reader']

It claims that neither of the readers are found. This is not true. Either it should only list the readers that are not found, or the error message should be reformulated to something like "At least one of the following readers could not be found:". The former would be more helpful.

Environment Info:

  • OS: openSUSE 15.0
  • Satpy Version: 0.21.1.dev79+g493ac55f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants