Windows 上带有 scrapyt 的 Ruby 1.9.2

发布于 2024-11-26 20:30:32 字数 1721 浏览 2 评论 0原文

在Windows上使用scrubyt和Ruby 1.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'

似乎与scruyt/中的@@agent = Mechanize::Mechanize.new有关core/navigation/agents/mechanize.rb 表明 Mechanize 未加载,尽管在文件中指定了“require 'mechanize'”

我安装了 mechanize (2.0.1), hpricot (0.8.4)、fireawtir (1.9.3) 和 nokogiri (1.5.0)

关于这个问题的原因有什么想法吗?

Using scrubyt with Ruby 1.9.2 on Windows, and get the following error when calling 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'

It seems to be related to @@agent = Mechanize::Mechanize.new in scrubyt/core/navigation/agents/mechanize.rb that Mechanize is not loaded despite that in the file "require 'mechanize'" is specified

I installed mechanize (2.0.1), hpricot (0.8.4), fireawtir (1.9.3) and nokogiri (1.5.0)

Any ideas about why the issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

咋地 2024-12-03 20:30:32

现在通过使用 mechanize (0.9.3) 解决,并将 scrapyt-0.4.31\lib\scrubyt\core\navigation\agents\mechanize.rb、@@agent = Mechanize::Mechanize.new 更改为 @@agent = WWW::机械化。新。可能只是我自己的问题,但在这里发布解决方案以防其他人可以使用它......

Solved now by using mechanize (0.9.3) and changed scrubyt-0.4.31\lib\scrubyt\core\navigation\agents\mechanize.rb, @@agent = Mechanize::Mechanize.new to @@agent = WWW::Mechanize.new. Might just be a problem at my own, but post the solution here in case anyone else can use it...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文