python-benedict: `from_ini()` returns a `str` instead of a `dict`
Python version Python 3.11.0
Package version python-benedict==0.30.0
Current behavior (bug description)
from benedict import benedict
original = benedict({
'section1': {'key1': 'value1'},
'sectionA': {'keyA': 'valueA', 'keyB': 'valueB', 'keyC': {'subkeyC': 'subvalueC'}},
})
readback = benedict.from_ini(original.to_ini())
print('original vs readback')
path = 'sectionA.keyC'
print(original.get(path), type(original.get(path)))
print('-- vs --')
print(readback.get(path), type(readback.get(path)))
output
original vs readback
{'subkeyC': 'subvalueC'} <class 'benedict.dicts.benedict'>
-- vs --
{'subkeyC': 'subvalueC'} <class 'str'>
Expected behavior value type of the keyC is a dict not a string
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 21 (10 by maintainers)
seems that encoder also must be changed
in the ‘str’ key’s and values must be in double-quotes that
json.loads
works. and True must be lower-case in the ini-fileso the encoder must be also modified
as far as i understand ini files:
i guess the encoder doesn’t need any changes?
or what will happen when you always use in the
INISerializer
something like the followingpseudo-code