python-libconf icon indicating copy to clipboard operation
python-libconf copied to clipboard

Cannot use periods/dots in key names

Open mattymo opened this issue 1 year ago • 0 comments

>>> print(libconf.dumps({'source.name': 'test'}))
source.name = "test";

>>> print(libconf.dumps({'rules': {'source.name': 'test'}}))
rules =
{
    source.name = "test";
};

>>> l = libconf.loads((libconf.dumps({'rules': {'source.name': 'test'}})))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mmosesohn/venv/lib/python3.8/site-packages/libconf.py", line 515, in loads
    return load(f, filename=filename, includedir=includedir)
  File "/home/mmosesohn/venv/lib/python3.8/site-packages/libconf.py", line 489, in load
    tokenstream = TokenStream.from_file(f,
  File "/home/mmosesohn/venv/lib/python3.8/site-packages/libconf.py", line 272, in from_file
    tokens.extend(tokenizer.tokenize(''.join(lines)))
  File "/home/mmosesohn/venv/lib/python3.8/site-packages/libconf.py", line 197, in tokenize
    yield cls(type, m.group(0),
  File "/home/mmosesohn/venv/lib/python3.8/site-packages/libconf.py", line 102, in __init__
    self.value = float(self.text)
ValueError: could not convert string to float: '.'

mattymo avatar Aug 24 '23 22:08 mattymo