toml icon indicating copy to clipboard operation
toml copied to clipboard

TomlDecodeError: Loading with multiple dictionaries within a dictionary.

Open CJP-Whitt opened this issue 2 years ago • 1 comments

Version: v0.10.2 False Error: 'Invalid inline table value encountered'

I get the following error while trying to load the below TOML from a file: toml.decoder.TomlDecodeError: Invalid inline table value encountered

The contents of the TOML file: bad = {x = {y = {a = 1}, z = {b = 1}}}

  • This is valid TOML and should parse fine. It will import correctly using tomli load.
  • This error repeats for multiple dictionaries within any dictionary with a depth of 2 or more.

For example, these TOML contents parse fine:

  • good = {x = {a = 1}, y = {b = 1}}
  • good = {x = {y = {a = 1}}}}

And this will fail as well:

  • bad = {x = {y = {w = {a = 1}, z = {b = 1}}}}

CJP-Whitt avatar Mar 31 '23 20:03 CJP-Whitt

Similar example with problems:

bad = {x = [[1, 1], [1, 2]]}

good = {x = [[1, 1]]}

good = {x = [1, 2]}

quimey avatar Sep 19 '23 20:09 quimey