Yaml - ruby 1.8.1 (2003-12-25) [i686-linux]

Hello,
I’m trying to use yaml for the first time - i’m getting a load error
yaml/parser - it dies here in yaml.rb.

begin
    require 'yaml/syck'
    @@parser = YAML::Syck::Parser
    @@loader = YAML::Syck::DefaultLoader
    @@emitter = YAML::Syck::Emitter
rescue LoadError
    require 'yaml/parser'
    @@parser = YAML::Parser
    @@loader = YAML::DefaultLoader
    require 'yaml/emitter'
    @@emitter = YAML::Emitter
end

Looking in the 1.8 distrib, i dont find the yaml/parser…

Seems syck is the preferred parser - and should be installed, what am i
missing?

Thanks,Paul

Paul, YAML support comes with Ruby 1.8.1. All you need to do is:

require ‘yaml’

Then you can do whatever you need.

···

On Mon, 31 May 2004 02:27:34 +0900, Paul Vudmaska wrote

Hello,
I’m trying to use yaml for the first time - i’m getting a load error
yaml/parser - it dies here in yaml.rb.

begin
    require 'yaml/syck'
    @@parser = YAML::Syck::Parser
    @@loader = YAML::Syck::DefaultLoader
    @@emitter = YAML::Syck::Emitter
rescue LoadError
    require 'yaml/parser'
    @@parser = YAML::Parser
    @@loader = YAML::DefaultLoader
    require 'yaml/emitter'
    @@emitter = YAML::Emitter
end

begin
cf = File.open configuration_file
rescue Exception => e
mylog.error “Ut oh. Couldn’t load the configuration file: #{e}”
raise
end

@@config = YAML::load(cf)

File.open(‘mydata’,‘w+’) {|fh| fh.print mydata.to_yaml}

and so on.

Kirk Haines

In article 40BA1980.50000@vudmaska.com,

···

Paul Vudmaska paul@vudmaska.com wrote:

Hello,
I’m trying to use yaml for the first time - i’m getting a load error
yaml/parser - it dies here in yaml.rb.

begin
require ‘yaml/syck’
@@parser = YAML::Syck::Parser
@@loader = YAML::Syck::DefaultLoader
@@emitter = YAML::Syck::Emitter
rescue LoadError
require ‘yaml/parser’
@@parser = YAML::Parser
@@loader = YAML::DefaultLoader
require ‘yaml/emitter’
@@emitter = YAML::Emitter
end

Looking in the 1.8 distrib, i dont find the yaml/parser…

Seems syck is the preferred parser - and should be installed, what am i
missing?

    • You are missing

…/1.8/i686-linux/syck.so

most likely. Yaml/parser is not in 1.8.

_ Booker C. Bense

Kirk Haines wrote:

Hello,
I’m trying to use yaml for the first time - i’m getting a load error
yaml/parser - it dies here in yaml.rb.

begin
require ‘yaml/syck’
@@parser = YAML::Syck::Parser
@@loader = YAML::Syck::DefaultLoader
@@emitter = YAML::Syck::Emitter
rescue LoadError
require ‘yaml/parser’
@@parser = YAML::Parser
@@loader = YAML::DefaultLoader
require ‘yaml/emitter’
@@emitter = YAML::Emitter
end

Paul, YAML support comes with Ruby 1.8.1. All you need to do is:

require ‘yaml’

Then you can do whatever you need.


begin
cf = File.open configuration_file
rescue Exception => e
mylog.error “Ut oh. Couldn’t load the configuration file: #{e}”
raise
end

@@config = YAML::load(cf)

File.open(‘mydata’,‘w+’) {|fh| fh.print mydata.to_yaml}

and so on.

Kirk Haines

That is what I thot, but…
[webmaster@iis webmaster]$ ruby -v
ruby 1.8.1 (2003-12-25) [i686-linux]

[webmaster@iis webmaster]$ ruby -e “p require(‘yaml’)”
/usr/local/lib/ruby/1.8/yaml.rb:17:in require': No such file to load -- yaml/parser (LoadError) from /usr/local/lib/ruby/1.8/yaml.rb:17 from -e:1:in require’
from -e:1

begin
    require 'yaml/syck'
    @@parser = YAML::Syck::Parser
    @@loader = YAML::Syck::DefaultLoader
    @@emitter = YAML::Syck::Emitter
rescue LoadError
    require 'yaml/parser'
    @@parser = YAML::Parser
    @@loader = YAML::DefaultLoader
    require 'yaml/emitter'
    @@emitter = YAML::Emitter
end

Looking at the source of yaml.rb (part of it above) points to
yaml/parser, which is phyisically not there in the file system.

This is on the box which I’ve had multiple issues with
and which i did not install the sw. This is the same place i could not get
mysql-ruby to fly.

This is my new host…

ruby 1.8.1 (2003-12-25) [i686-linux]
[root@u15154846 root]# ruby -e “p require(‘yaml’)”
true

Perhaps that is why so much problem was had getting
mysql-ruby to work but who knows. i’ll be glad to get
out of there in any case.

···

On Mon, 31 May 2004 02:27:34 +0900, Paul Vudmaska wrote

[webmaster@iis webmaster]$ ruby -e "p require('yaml')"
/usr/local/lib/ruby/1.8/yaml.rb:17:in `require': No
such file to load -- yaml/parser (LoadError)
        from /usr/local/lib/ruby/1.8/yaml.rb:17
        from -e:1:in `require'
        from -e:1

How ruby was installed ?

Normally you must have a file /usr/local/lib/ruby/1.8/yaml/syck.rb

Guy Decoux

This is an installation problem. Do you have root access on the box? If
so, I’d suggest just downloading the Ruby source and rebuilding. Building
Ruby is very easy, and at least then you would know that you had a proper
installation of it.

Kirk

···

On Mon, 31 May 2004 12:03:27 +0900, Paul Vudmaska wrote

That is what I thot, but…
[webmaster@iis webmaster]$ ruby -v
ruby 1.8.1 (2003-12-25) [i686-linux]

[webmaster@iis webmaster]$ ruby -e “p require(‘yaml’)”
/usr/local/lib/ruby/1.8/yaml.rb:17:in require': No such file to load -- yaml/parser (LoadError) from /usr/local/lib/ruby/1.8/yaml.rb:17 from -e:1:in require’
from -e:1