Rails 3 - psych.rb - 无法解析YAML

时间:2011-11-02 18:08:09

标签: ruby-on-rails backgroundrb

在集成backgroundrb-rails3时,我收到以下错误,

~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 8 column 22 (Psych::SyntaxError)
from ~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
from ~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:119:in `parse'
from ~/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:106:in `load'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/backgroundrb-rails3-1.1.6/lib/backgroundrb/bdrb_config.rb:27:in `read_config'
from ~/workspace/artbee/Trunk/script/load_worker_env.rb:25:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/packet-0.1.15/bin/packet_worker_runner:25:in `require'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/packet-0.1.15/bin/packet_worker_runner:25:in `initialize'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/packet-0.1.15/bin/packet_worker_runner:47:in `new'
from ~/.rvm/gems/ruby-1.9.2-p290/gems/packet-0.1.15/bin/packet_worker_runner:47:in `<top (required)>'
from ~/.rvm/gems/ruby-1.9.2-p290/bin/packet_worker_runner:19:in `load'
from ~/.rvm/gems/ruby-1.9.2-p290/bin/packet_worker_runner:19:in `<main>'

我在堆栈溢出中发现similar question,并且接受的答案对我有效。

我不想使用Syck,我怎么能用Psych修复它?两者的yml格式有什么不同吗?由于回溯没有指向任何yaml文件,我该如何调试更多?

非常感谢任何帮助...

1 个答案:

答案 0 :(得分:1)

好的,看起来Psych无法解析默认配置中的这一特定行:

:trigger_args: */5 * * * * * *

用引号括起条件应该解决它:

:trigger_args: "*/5 * * * * * *"

您可以将默认配置复制到config文件夹中,然后在此处进行更改。以下是要使用的确切文件:https://raw.github.com/mtylty/backgroundrb-rails3/master/config/backgroundrb.yml