Starting rails server on 3.0.5 gives Psych::SyntaxError - Parsing YAML

Hello,

I just updated to using Rails 3.0.5 and was on Ruby 1.9.2p0 but
replaced that with 1.9.2p180 to try and get the over problem below but
am unable to. After creating a new project and adding a few gems to
Gemfile and bundle install (and update to make sure) when I try to
start the server with “rails s” command I get the error below - no
other controllers/models/views added.

I have Googled around and I find two things

  1. Suggestion to add the two lines below to the top of boot.rb file

require ‘yaml’
YAML::ENGINE.yamler= ‘syck’

… but it doesn’t work … gives another YAML parsing error

  1. I see in some posts/places that the issue has been identified and
    fixed and someone (Aaron?) is in the process of updating the releases
  • so I did a bundle update to make sure I have the latest stuff and
    got the latest Ruby version. Still get the error below.

It would seem like I am missing something simple and obvious here
otherwise I would expect lot more posts on this topic in this forum
but I don’t see any here. Thanks for your help and pointers to get
over this - I am in a Windows 7 box. If I need to revert back to some
older version of Ruby/Rails to get past this error I am happy to do
that - just starting out migrating from 2.3.8 to 3.0.

Thanks,
-S

C:/Ruby192/lib/ruby/1.9.1/psych.rb:148:in parse': couldn't parse YAML at line 36 column 5 (Psych::SyntaxError) from C:/Ruby192/lib/ruby/1.9.1/psych.rb:148:inparse_stream’
from C:/Ruby192/lib/ruby/1.9.1/psych.rb:119:in parse' from C:/Ruby192/lib/ruby/1.9.1/psych.rb:106:inload’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/application/configuration.rb:88:in database_configuration' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/ lib/active_record/railtie.rb:58:inblock (2 levels) in
class:Railtie
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/
lib/active_support/lazy_load_hooks.rb:36:in instance_eval' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/ lib/active_support/lazy_load_hooks.rb:36:inexecute_hook’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/
lib/active_support/lazy_load_hooks.rb:26:in on_load' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/ lib/active_record/railtie.rb:57:inblock in class:Railtie
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/initializable.rb:25:in instance_exec' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/ rails/initializable.rb:25:inrun’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/initializable.rb:50:in block in run_initializers' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/ rails/initializable.rb:49:ineach’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/initializable.rb:49:in run_initializers' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/ rails/application.rb:134:ininitialize!’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/application.rb:77:in method_missing' from C:/rails3/agd/config/environment.rb:5:in<top
(required)>’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/
lib/active_support/dependencies.rb:239:in require' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/ lib/active_support/dependencies.rb:239:inblock in require’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/
lib/active_support/dependencies.rb:225:in block in load_dependency' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/ lib/active_support/dependencies.rb:596:innew_constants_in’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/
lib/active_support/dependencies.rb:225:in load_dependency' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5/ lib/active_support/dependencies.rb:239:inrequire’
from C:/rails3/agd/config.ru:3:in block in <main>' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/ builder.rb:46:ininstance_eval’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/
builder.rb:46:in initialize' from C:/rails3/agd/config.ru:1:innew’
from C:/rails3/agd/config.ru:1:in <main>' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/ builder.rb:35:ineval’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/
builder.rb:35:in parse_file' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/ server.rb:162:inapp’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/
server.rb:248:in wrapped_app' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.2/lib/rack/ server.rb:213:instart’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/commands/server.rb:65:in start' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/ rails/commands.rb:30:inblock in <top (required)>’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/
rails/commands.rb:27:in tap' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/ rails/commands.rb:27:in<top (required)>’

On Apr 3, 3:40am, skt [email protected] wrote:

It would seem like I am missing something simple and obvious here
otherwise I would expect lot more posts on this topic in this forum
but I don’t see any here. Thanks for your help and pointers to get
over this - I am in a Windows 7 box. If I need to revert back to some
older version of Ruby/Rails to get past this error I am happy to do
that - just starting out migrating from 2.3.8 to 3.0.

Sounds to me like there is a syntax error in your database.yml file
(possibly at line 36)

Fred

On Apr 4, 11:54am, claus mller [email protected] wrote:

de:
worth when it cannot contain local characters? Did anyone test this code
with a different file than en.yml?

Well the presence of things like this

suggests that it is possible. Did you try quoting your strings?

Fred

Hi,

I have the same problem; I re-installed ruby & rails

ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
Rails 3.0.5

I got this parsing error, when psyche.rb tried to parse my de.yml locale
file which contains a German umlaut:

de:
previous: zurück
next: weiter

When I change this file to

de:
previous: zurueck
next: weiter

the problem does not appear anymore. What in the hell is a locale file
worth when it cannot contain local characters? Did anyone test this code
with a different file than en.yml?

claus-michael

Frederick C. wrote in post #990818:

On Apr 4, 11:54am, claus mller [email protected] wrote:

de:
worth when it cannot contain local characters? Did anyone test this code
with a different file than en.yml?

Well the presence of things like this
rails-i18n/rails/locale/hi.yml at master · svenfuchs/rails-i18n · GitHub
suggests that it is possible. Did you try quoting your strings?

Fred

Hi Fred,

no - quoting doesn’t help :frowning: would be quite a task to quote everything
in a large de.yml file…

I suppose that the parser does not like UTF-8.

Claus-Michael

answer.
We had this happen to a custom YML file… culprit ended up being two
dashes instead of the required three dashes to start off the yaml
file… only came up for a colleague using ruby 1.9.x…

I notice none of my locale files have any dashes at all though, but for
what it’s worth…

On Apr 4, 7:12pm, claus mller [email protected] wrote:

Fred

Hi Fred,

no - quoting doesn’t help :frowning: would be quite a task to quote everything
in a large de.yml file…

I suppose that the parser does not like UTF-8.

I doubt it’s that - I’ve had utf8 i18n files before. YAML is quite
sensitive to whitespace (space versus tabs etc). If you can trim your
file down to a minimal file that doesn’t parse you may find your
answer.

Fred

I doubt it’s that - I’ve had utf8 i18n files before. YAML is quite
sensitive to whitespace (space versus tabs etc). If you can trim your
file down to a minimal file that doesn’t parse you may find your
answer.

Fred

my de.yml consists of three lines:

de:
previous: zurück
next: weiter

This one fails. When I change ‘zurück’ to ‘zurueck’, it works. It seems
apparent that the umlaut ‘ü’ causes the problem. Or any other idea?

Claus-Michael