Skip to content

Unable to save Config with * args to str/disk #52

@HLasse

Description

@HLasse

Hi!

As part of my workflow, I want to save my Config to disk so I can reload it later. However, if the config contains a * section this fails.

Minimal example:

from confection import Config

test_cfg = """[test]
foo = bar

[test.*]
bar = foo
"""

cfg = Config().from_str(test_cfg)

cfg.to_str()

This results in

File "e:\lasse\test\psycop-common\test_confection.py", line 12, in <module>
    cfg.to_str()
  File "E:\ProgramData\Anaconda3\envs\psycop-main\lib\site-packages\confection\__init__.py", line 419, in to_str
    flattened.set(section_name, key, try_dump_json(value, node))
  File "E:\ProgramData\Anaconda3\envs\psycop-main\lib\configparser.py", line 1205, in set
    super().set(section, option, value)
  File "E:\ProgramData\Anaconda3\envs\psycop-main\lib\configparser.py", line 903, in set
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'test.*'

Tested on Windows and MacOS, using confection 0.1.3 and 0.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions