On Fri, Dec 10, 2010 at 8:52 PM, A. Mcbomb <atomicmcbomb / gmail.com> wrote:
> I never heard of mechanize but I see from the doco that it requires
> Nokogiri to run. I have a working copy of Nokogiri and just did a
> successful 'gem install mechanize' but when I ran your basic script, I
> get:
>
> [root@trebek2 bin]# ./mechanize.rb
> ./mechanize.rb:7: uninitialized constant Mechanize (NameError)
> =A0 =A0 =A0 =A0from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> =A0 =A0 =A0 =A0from
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `require'
> =A0 =A0 =A0 =A0from ./mechanize.rb:5
>
> Am I missing something?

Hmm... I'm not sure there... oh wait... Could it be confused since
your file is (also) named 'mechanize'?:

$ cp i.rb mechanize.rb
$ ruby mechanize.rb
./mechanize.rb:5: uninitialized constant Mechanize (NameError)
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
	from mechanize.rb:3

Yeah, I think that's it.  Try renaming your script.