Rails 3 - psych.rb - 无法解析 YAML
在集成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>'
我在堆栈中发现了一个类似问题溢出并且接受的答案对我有用。
我不想使用 Syck,如何使用 Psych 修复它?两者的 yml 格式有什么区别吗?由于回溯没有指向任何 yaml 文件,我如何调试更多?
非常感谢任何帮助...
While integrating backgroundrb-rails3 I get the following error,
~/.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>'
I found a similar question in stack overflow and the accepted answer works for me.
I don't want to use Syck, how can i fix it with Psych? Is there any difference in yml format for both? As the backtrace is not pointing to any yaml file, how can i debug more?
Any help is highly appreciated...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,看起来 Psych 无法从默认配置中解析此特定行:
将条件括在引号中应该可以修复它:
您可以将默认配置复制到您的
config
文件夹中并在其中进行此更改。这是要使用的确切文件: https://raw.github .com/mtylty/backgroundrb-rails3/master/config/backgroundrb.ymlOk, it looks like Psych can't parse this specific line from the default configuration:
Wrapping the conditions in quotes should fix it:
You can copy the default config into your
config
folder and make this change there. Here is the exact file to use: https://raw.github.com/mtylty/backgroundrb-rails3/master/config/backgroundrb.yml