Ruby LoadError, Quick fix 4

Posted by Rajesh Shetty on March 31, 2006

Ruby library load error, takes long time for a newbie but simple hack could get you up and running with your thing.
I just installed RubyFul_Soup[ Ruby port of the hit Python HTML/XML parser Beautiful Soup.] and wanted get started with RadRails , so when I write this line on top

require ‘RubyFulSoup’ as per the example given I get following error

LoadError: No such file to load — rubyfulsoup

The thing is when you install any gem using “gem install” , it installs gem under /usr/lib/ruby/gems/1.8/gems , so somehow ruby does not really get where to pick up gems from , best thing to do a quick sanity check regarding your setup , and you can do that by irb” (Interactive Ruby Shell), just type
bash> irb
irb(main):002:0> require ‘RubyFulSoup’
LoadError: No such file to load — RubyFulSoup
from (irb):2:in `require’
from (irb):2

basically gem installed is “rubyful_soup’ and its under /usr/lib/ruby/gems/1.8/gems
and Ruby looks for files under /usr/lib/ruby/1.8/ , So all I did is copied rubyful_soup.rb file from /usr/lib/ruby/gems/1.8/gems to /usr/lib/ruby/1.8/ and also copy htmltools gem files to /usr/lib/ruby/1.8/, then run

irb(main):001:0> require ‘rubyful_soup’
=> true

This is a quick fix till I figure out the real solution for this


Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Kelly Thu, 20 Apr 2006 22:55:00 EDT

    Instead of copying files around, try this:

    require ‘rubygems’
    require ‘rubyful_soup’

    Worked for me. :)

  2. Rajesh Shetty Fri, 21 Apr 2006 11:39:00 EDT

    Will try that one, Thanks Kelly

  3. Anonymous Wed, 28 Jun 2006 01:49:00 EDT

    requiring “rubygems” didn’t work for me.

  4. Anonymous Wed, 19 Jul 2006 14:44:00 EDT

    I say briefly: Best! Useful information. Good job guys.
    »

Comments