Re: Ruby and Python YAML 1.{0,1} Compatibility

Ingy dot Net <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Anders,

Ruby 1.9 has support for Psych which uses libyaml. Python uses libyaml,
which is 1.1.

Abandoning libsyck in favor of libyaml is generally our advice here.

Please try Psych on Ruby, and let us know if this fixes things. I think it
will.

- Ingy

On Tue, Jul 27, 2010 at 2:40 AM, Anders Arpteg <[email protected]>wrote:

> Hi,
>
> We are having problem with the Ruby and the Python implementation of
> YAML. Ruby seems to be YAML 1.0 and Python shall be YAML 1.1
> compatible. Hopefully, one would wish that the Python implementation
> was backward compatible and able to parse Ruby encoded data. However,
> that seems not to be the case. See example below.
>
> I have tried with the PySyck module that is YAML 1.0 compatible, and
> it can then parse the Ruby YAML. However, that project seems abandoned
> and seems to have problems with certain python versions. Anyone with
> similar problems, and possible solutions?
>
> This cause serious problems for us and it seems very strange that YAML
> is not even backwards compatible. Perhaps we have to switch to JSON or
> some other format to overcome this problem, but hopefully have I
> overlooked some issue/solution that someone in this mailing list can
> help me with.
>
> Thanks in advance!
> Anders
>
> Ruby 1.9.0:
>
> >> require 'yaml'
> => []
> >> YAML.dump('å')
> => "--- !binary |\nw6U=\n\n"
>
> Python 2.6.5:
>
> >>> import yaml
> >>> yaml.safe_load("--- !binary |\nw6U=\n\n")
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/usr/lib/python2.6/dist-packages/yaml/__init__.py", line 75,
> in safe_load
>    return load(stream, SafeLoader)
>  File "/usr/lib/python2.6/dist-packages/yaml/__init__.py", line 58,
> in load
>    return loader.get_single_data()
>  File "/usr/lib/python2.6/dist-packages/yaml/constructor.py", line
> 42, in get_single_data
>    node = self.get_single_node()
>  File "/usr/lib/python2.6/dist-packages/yaml/composer.py", line 39,
> in get_single_node
>    if not self.check_event(StreamEndEvent):
>  File "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 93, in
> check_event
>    self.current_event = self.state()
>  File "/usr/lib/python2.6/dist-packages/yaml/parser.py", line 169, in
> parse_document_start
>    self.peek_token().start_mark)
> yaml.parser.ParserError: expected '<document start>', but found
> '<scalar>'
>  in "<string>", line 2, column 1:
>    w6U=
>    ^
> >>>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://ad.doubleclick.net/clk;226879339;13503038;l?
> http://clk.atdmt.com/CRS/go/247765532/direct/01/
> _______________________________________________
> Yaml-core mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/yaml-core
>
>

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share 
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.