#32 new
cyberkid81

first tutorial sample program generates run error - help?

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

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: http://scrubyt.lighthouseapp.com/projects/18686/tickets/31-jopenssl...

Thanks!

Comments and changes to this ticket

  • cyberkid81

    cyberkid81 May 8th, 2010 @ 11:34 PM

    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
    
  • cyberkid81

    cyberkid81 May 9th, 2010 @ 12:50 AM

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

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.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

A simple to learn and use, yet powerful web scraping toolkit written in Ruby.

People watching this ticket

Pages