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

P

Paul Vudmaska

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
 
K

Kirk Haines

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

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
 
P

Paul Vudmaska

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




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

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.
 
T

ts

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

How ruby was installed ?

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


Guy Decoux
 
K

Kirk Haines

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

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
 
B

Booker C. Bense

-----BEGIN PGP SIGNED MESSAGE-----

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


-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBQL5ij2TWTAjn5N/lAQHdRwP/ZPKrNgr0rjU0cKa7JwhQzIJClp70qI7F
h5/GYKdN3sejL+J3uSHaJthSCf9E1skH5ME+LYCbniMvgd4D7n24mz+sSjPB/PwU
7q34RbPeqfRS5SzKVsfRAnaa2byQzdR324GkycRyEfGu8pYH9CzPKqEHz/0yNoDw
NgA58RqIG/E=
=jJNt
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top