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

segment_gatherer fails with yaml ParserError when passed ini-config file from examples directory #71

Open
gerritholl opened this issue Jan 13, 2021 · 2 comments

Comments

@gerritholl
Copy link
Contributor

The examples/ directory contains some configuration files in .ini and some in .yaml. I used the trollstalker_config.ini_template to configure a trollstalker.ini, and similarly for trollstalker_logging.ini. This is handled well by trollstalker -c trollstalker.ini. I then used segment_gatherer.ini_template as a template to configure my segment_gatherer.ini, but when I then ran segment_gatherer -c segment_gatherer.ini it failed with an exception — apparently segment_gatherer wants yaml files now.

To reproduce

  • Create a segment_gatherer.ini file
  • Run segment_gatherer -c segment_gatherer.ini

Expected result

Since I based this off an example in current git master, I expected it to work with current git master.

Actual result

Traceback (most recent call last):
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/bin/segment_gatherer.py", line 95, in <module>
    main()
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/bin/segment_gatherer.py", line 57, in main
    config = read_yaml(args.config)
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/lib/python3.8/site-packages/pytroll_collectors/helper_functions.py", line 209, in read_yaml
    data = yaml.load(fid, Loader=yaml.SafeLoader)
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/lib/python3.8/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/lib/python3.8/site-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/lib/python3.8/site-packages/yaml/composer.py", line 39, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/lib/python3.8/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/opt/pytroll/pytroll_inst/miniconda3/envs/pytroll-py38/lib/python3.8/site-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<scalar>'
  in "segment_gatherer.ini", line 2, column 1

Desired solution

The examples/ directory should only contain configuration file formats that are current. Any older formats should be converted to the equivalent in the current formats and then the old files should be deleted.

Further context

It appears that zipcollector_config also contains both ini and yaml examples.

@pnuu
Copy link
Member

pnuu commented Jan 14, 2021

When using .ini configs also -C <section-name> needs to be given.

@gerritholl
Copy link
Contributor Author

I see, yes, that works. It wasn't clear to me that this was a mandatory option.

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

2 participants