我试图解析一些Ruby代码生成的YAML(https://github.com/devrandom/gitian-builder/blob/81bf5d70252363a95cb75eea70f8d1d129948013/bin/gbuild#L322)。我试图使用PyYAML解析它。当PyYAML在解析YAML时遇到问题时,我尝试了一个在线验证器(http://yaml-online-parser.appspot.com/),但它失败并出现以下错误:
ERROR:
could not determine a constructor for the tag '!omap'
in "<unicode string>", line 1, column 5:
--- !omap
^
我在YAML网站上看到(不能发布超过两个链接)!! omap看起来是正确的,而不是!omap。那么为什么Ruby在使用YAML::Omap
时输出!omap?
我无法在网上找到解释此行为的任何内容。
如果你想看一个我试图解析的YAML的例子,在比特币帐户下搜索GitHub上的gitian.sigs repo并查看那里的任何.assert文件(同样,我可以&#39;发布两个以上的链接)。
答案 0 :(得分:3)
事实证明,这是Syck的遗产。虽然它应该是!!omap
,但我被告知我应该告诉我的解析器!omap
与!!omap
相同。