Yaml error. dunno why

i have a simple yml file and am trying to parse it.

development:
    TWSDirectory: E:\Jts\dlqkjifys\
     Second: E:\Jts\test\

i get a error that i am not able to comprehend. pl help
irb(main):020:0> conf = YAML::load(File.open(RailsDirectory+ 'config/
constants.y
ml'))
'rgumentError: syntax error on line 5, col 12: ` Second: E:\Jts
\test\
        from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
        from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
        from (irb):20

i have a simple yml file and am trying to parse it.

development:
   TWSDirectory: E:\Jts\dlqkjifys\
    Second: E:\Jts\test\

i get a error that i am not able to comprehend. pl help
irb(main):020:0> conf = YAML::load(File.open(RailsDirectory+ 'config/
constants.y
ml'))
'rgumentError: syntax error on line 5, col 12: ` Second: E:\Jts
\test\
       from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
       from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
       from (irb):20

···

On Nov 10, 2007 8:55 AM, Junkone <junkone1@gmail.com> wrote:
---
development:
  TWSDirectory: E:\Jts\dlqkjifys\
  Second: E:\Jts\test\

I believe that --- is important, but I'm not sure. Try building your hash
in irb and YAML.dump it.

Michael Guterl

Junkone wrote:

i have a simple yml file and am trying to parse it.

development:
    TWSDirectory: E:\Jts\dlqkjifys\
     Second: E:\Jts\test\

i get a error that i am not able to comprehend. pl help
irb(main):020:0> conf = YAML::load(File.open(RailsDirectory+ 'config/
constants.y
ml'))
'rgumentError: syntax error on line 5, col 12: ` Second: E:\Jts
\test\
        from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
        from (irb):20

I suspect the backslashes need to be escaped:

h = YAML.load(<<END)
development:
   TWSDirectory: E:\\Jts\\dlqkjifys\\
   Second: E:\\Jts\\test\\
END

puts h.to_yaml

__END__

Output:

···

---
development:
   TWSDirectory: E:\Jts\dlqkjifys\
   Second: E:\Jts\test\

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Hi,

i have a simple yml file and am trying to parse it.

development:
    TWSDirectory: E:\Jts\dlqkjifys\
     Second: E:\Jts\test\

First, make sure your items are indented at the same level:

development:
    TWSDirectory: E:\Jts\dlqkjifys\
    Second: E:\Jts\test\

Notice the way "TWSDirectory" and "Second" have the same number of
spaces before them.

This may still not work. Have a look at this example:

irb(main):008:0> YAML.load <<-YAML
irb(main):009:0" abcdefg\
irb(main):010:0" hijkl
irb(main):011:0" YAML
=> "abcdefghijkl"

Your "\" at the end of the line is joining the two lines into one!
Suffice to say, this works:

irb(main):017:0> YAML.load <<YAML
irb(main):018:0" development:
irb(main):019:0" TWSDirectory: E:\Jts\dlqkjifys
irb(main):020:0" Second: E:\Jts\test
irb(main):021:0" YAML
=> {"development"=>{"TWSDirectory"=>"E:Jtsdlqkjifys", "Second"=>"E:Jts
\test"}}
irb(main):022:0>

i get a error that i am not able to comprehend. pl help
irb(main):020:0> conf = YAML::load(File.open(RailsDirectory+ 'config/
constants.y
ml'))
'rgumentError: syntax error on line 5, col 12: ` Second: E:\Jts
\test\
        from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
        from e:/ruby/lib/ruby/1.8/yaml.rb:133:in `load'
        from (irb):20

Hope this helps,

Arlen

···

On Sat, 2007-11-10 at 22:55 +0900, Junkone wrote: