在Windows上使用Ruby1.9.2时,在调用Scrubyt::Extractor.define do时会出现以下错误
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:479:in load_missing_constant': Scrubyt::Navigation is not missing constant Mechanize! (ArgumentError)
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:183:inblock in const_missing'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:in each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:181:inconst_missing'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/navigation/agents/mechanize.rb:17:in block in included'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/navigation/agents/mechanize.rb:16:inmodule_eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/navigation/agents/mechanize.rb:16:in included'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:29:ininclude'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:29:in block in define'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:28:inclass_eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/scrubyt-0.4.31/lib/scrubyt/core/shared/extractor.rb:28:in `define'尽管在文件中指定了“要求‘机械化’”,但没有加载机械化,这似乎与@@agent = Mechanize::Mechanize.new /core/navigation/agents/ Mechanize ize.rb中的核心有关
我安装了mechanize (2.0.1),hpricot (0.8.4),fireawtir (1.9.3)和nokogiri (1.5.0)
你知道为什么会出现这个问题吗?
发布于 2011-08-01 03:39:20
现在通过使用mechanize (0.9.3)解决,并将scrubyt-0.4.31\lib\scrubyt\core\navigation\agents\mechanize.rb,@@agent = Mechanize::Mechanize.new更改为@@agent = WWW::Mechanize.new。可能只是我自己的一个问题,但在这里发布解决方案,以防其他人可以使用它……
https://stackoverflow.com/questions/6836211
复制相似问题