Latest version of ruamel.yaml fails to parse simple flow mapping -


posting here instead of bitbucket because i'm unsure whether or not user error. simple broke after upgrading latest version:

>>> ruamel import yaml >>> test_str = '{"in":{},"out":{}}' >>> yaml.safe_load(test_str)  ruamel.yaml.parser.parsererror: while parsing flow mapping   in "<byte string>", line 1, column 1:     {"in":{},"out":{}}     ^ (line: 1) expected ',' or '}', got '<scalar>'   in "<byte string>", line 1, column 6:     {"in":{},"out":{}}          ^ (line: 1) 

putting spaces after "in" , "out" resolves issue.

this bug in ruamel.yaml<0.15.30.

the token scanner had been changed few micro versions earlier, in order allow :: , ?to occur in plain scalars (as required 1.2 specification, see example 7.10), , changes affected this, "compact json", syntax.

one workaround, if cannot upgrade ruamel.yaml, may easier changing yaml input, loading explicitly yaml 1.1:

from ruamel import yaml test_str = '{"in":{},"out":{}}' yaml.safe_load(test_str, version="1.1") 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -