Assignment of variables with underscore in their name causes pyparsing exception
With the following config file,
model{
d_in = 3
d_out = 2
}
I ran ConfigFactory.parse_file('./confs/test2.conf') and get an exception:
pyparsing.exceptions.ParseSyntaxException: , found '=' (at char 30), (line:3, col:11)
If I change d_out to e_out, or comment one of them out, or remove the underscore in at least one of their names, I will get no exception.
I get this with Python 3.11.3, Python 3.8.17 and pyparsing 3.1.0 and pyparsing 3.0.8
Cam for the exact same problem and from the name of the variables I assume from the same repository :wink: I guess the best is to just rename the parameters at this point
Actually pip install pyhocon==0.3.57 works
Happens to me with this config
x = 1
y = 1
so the issue is probably not related to underscores or nestedness.
When I reorder the parameters:
y = 1
x = 1
it is parsed correctly. Changing the values to float solves the issue as well.
That's a duplicate of https://github.com/chimpler/pyhocon/issues/324 and has been fixed by https://github.com/chimpler/pyhocon/pull/326 -> fixed in version 0.3.61: https://github.com/chimpler/pyhocon/releases/tag/0.3.61
=> Basically, variables with names starting with possible durations (ex: d_hello (d=day) or y_me (y=year) were incorrectly parsed if using "\n" with values, but fixed now
=> You can close this issue