rtoml icon indicating copy to clipboard operation
rtoml copied to clipboard

TomlParsingError when reading a TOML file

Open ruslaniv opened this issue 1 year ago • 1 comments

I'm trying to read a poetry toml file (which I'd think should not matter since it's a regular toml file) like this:

import rtoml
obj = rtoml.load("pyproject.toml")
print(obj)

and I'm getting

_rtoml.TomlParsingError: expected an equals, found eof at line 1 column 15

Here are few first lines from that file

[tool.poetry]
name = "datascience"
version = "0.1.0"

So it looks like it can't read the section [tool.poetry] line? But in the example it seems to read it without problems?

ruslaniv avatar Aug 02 '23 06:08 ruslaniv

According to the source. It seems that rtoml.load will pass the arg directly to rtoml.loads if you give it a str.

https://github.com/samuelcolvin/rtoml/blob/d79d03faad6d473f2482319365445a50c0df4e18/rtoml/init.py#L16-L26

Bogay avatar Aug 30 '23 07:08 Bogay