Require problem

I’m trying to use the WWW::Mechanize library and I created a short
script for it. When I run it I get an error saying:

./getfindata.rb:3:in `require’: No such file to load – mechanize
(LoadError)
from ./getfindata.rb:3

caused by the line:

require ‘mechanize’

which I got from an online example.

But if I do a gem list I see:

*** LOCAL GEMS ***

mechanize (0.4.0, 0.3.1)
Mechanize provides automated web-browsing

narf (0.7.3)
NARF is a replacement for and derivative of the Ruby CGI
library. It
exists to trivialize web development .

sources (0.0.1)
This package provides download sources for remote gem installation

So I’m clueless as to what is wrong.

Thanks for any help you can give me!

Ernest

Hi,

First try to require rubygems and then require mechanize, like this:

require ‘rubygems’
require ‘mechanize’

use WWW::Mechanize


Martins

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs