Re: : in the flow context for PyYAML and SnakeYAML
Kirill Simonov <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Hi William,
On 08/24/2010 08:32 PM, William Spitzak wrote:
> libyaml, which I thought was following the spec, quite specifically does
> not require a ':' in a "flow" context. There is code in there that
> literally says it is doing this, so somebody thought it was correct.
>
> Here is a conversion using the event api of libyaml to read and write
> some 1-line files (the output has "flow" and all quoting forced on to
> make it understandable):
>
> a:1 -> "a:1"
> a: 1 -> {"a": "1"}
> {a:1} -> {"a": "1"}
> {a: 1} -> {"a": "1"}
>
> So libyaml is doing what I think is being requested.
Not sure how you get these. The first two examples and the last one are
non-controversial. However I'm getting a scanner error on {a:1}:
>>> import yaml
>>> yaml.load("{a:1}", Loader=yaml.CLoader)
Traceback (most recent call last):
[...]
yaml.scanner.ScannerError: while scanning a plain scalar
in "<byte string>", line 1, column 2
found unexpected ':'
in "<byte string>", line 1, column 3
Note that CLoader uses libyaml bindings internally.
Perhaps you are using some patched version of libyaml?
Thanks,
Kirill
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d