Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

first tutorial sample program generates run error - help?

#32

I followed the tutorial here (and later copy and pasted the code to see if that helped) http://wiki.scrubyt.org/index.php?title=Your_First_Extractor

When running this code:

 require 'rubygems'
  require 'scrubyt'

 google_data = Scrubyt::Extractor.define do
   fetch          'http://www.google.com/ncr'
   fill_textfield 'q', 'ruby'
   submit

   result 'Ruby Programming Language'
 end

google_data.to_xml.write($stdout, 1)
Scrubyt::ResultDumper.print_statistics(google_data)

I get this error::

./google.rb
/usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navigation/agents/mechanize.rb:182:in `fill_textfield': undefined method `[]=' for nil:NilClass (NoMethodError)
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navigation/navigation_actions.rb:27:in `eval'
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navigation/agents/mechanize.rb:182:in `fill_textfield'
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/navigation/navigation_actions.rb:27:in `fill_textfield'
    from ./google.rb:8
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/shared/extractor.rb:75:in `instance_eval'
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/shared/extractor.rb:75:in `initialize'
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/shared/extractor.rb:32:in `new'
    from /usr/local/lib/ruby/gems/1.8/gems/scrubyt-0.4.1/lib/scrubyt/core/shared/extractor.rb:32:in `define'
    from ./google.rb:6

Does anyone know why that may be happening? This is a fresh installation so it may not be working 100% properly. The install is detailed here: #31 jopenssl error?

Thanks!

Reported by cyberkid81 · May 8th, 2010 @ 11:27 PM

State: new
Milestone: none
Assigned to: nobody

Activity

  1. cyberkid81
    cyberkid81

    Fixed, partially by running these three commands:

      gem uninstall hpricot mechanize
      gem install hpricot -v=0.6.164
      gem install mechanize -v=0.8.5
    

    I now get an error when the Dumper runs, but the scraping looks to have worked.

    ./google.rb

    <result>Ruby Programming Language</result>
    <result>Download Ruby</result>
    <result>Ruby - The Inspirational Weight Loss Journey on the Style Network ...</result>
    <result>Ruby (programming language) - Wikipedia, the free encyclopedia</result>
    <result>Ruby - Wikipedia, the free encyclopedia</result>
    <result>Ruby on Rails</result>
    <result>Ruby&amp;#39;s Diner - rubys.com</result>
    <result>Ruby Annotation</result>
    <result>Watir</result>
    <result>[Ruby-Doc.org: Documenting the Ruby  Language]</result>
    <result>News for ruby</result>
    <result>Books for ruby</result>
    

    /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:440:in load_missing_constant': uninitialized constant Scrubyt::ResultDumper (NameError)

        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
        from ./google.rb:15
    

    May 8th, 2010 @ 11:34 PM

  2. cyberkid81
    cyberkid81

    i see from the code its self that the dumper is no longer working. i guess i won't use it.

    May 9th, 2010 @ 12:50 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.