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

TOMLDecodeError: Invalid initial character for a key part #199

Closed
marxin opened this issue Jul 25, 2022 · 2 comments
Closed

TOMLDecodeError: Invalid initial character for a key part #199

marxin opened this issue Jul 25, 2022 · 2 comments
Labels
question Further information is requested

Comments

@marxin
Copy link

marxin commented Jul 25, 2022

I noticed tomli is stricter than toml when it comes to whitespaces:

$ cat sample.toml
digests = [
  {
    key = "value",
    key2 = "value2"
  }
]
$ In [4]: toml.load('sample.toml')
Out[4]: {'digests': [{'key': 'value', 'key2': 'value2'}]}
$ In [5]: tomli.load(open('sample.toml', 'rb'))
...
    403     return parse_one_line_basic_str(src, pos)
--> 404 raise suffixed_err(src, pos, "Invalid initial character for a key part")

TOMLDecodeError: Invalid initial character for a key part (at line 2, column 4)

Is it something that can be relaxed, please?

@hukkin
Copy link
Owner

hukkin commented Jul 25, 2022

Hi there!

Tomli implements the TOML spec. This can only be relaxed if the spec changes. Quoting https://toml.io/en/v1.0.0#inline-table

No newlines are allowed between the curly braces unless they are valid within a value.

I'm closing this in favor of toml-lang/toml#516

@hukkin hukkin closed this as completed Jul 25, 2022
@hukkin hukkin added the question Further information is requested label Jul 25, 2022
@marxin
Copy link
Author

marxin commented Jul 25, 2022

Thanks, appreciate your fast reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants