-1

The very first line of this program is where the error happens,

require 'grackle'

This is code I wrote this morning while I was in class and with the entire program (which starts with 'require grackle') I was able to read tweets and write them directly from the command line. Now I get home and try to run the exact same program on my mac (from irb) and get this:

source "grackle.rb"

>> require 'grackle'
NameError: uninitialized constant Grackle
 from ./grackle.rb:5
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
 from grackle.rb:2
>> require 'json'
=> false
>> require 'highline/import'
=> false
>> 
?>  $client = Grackle::Client.new( :auth => {
...(Oauth keys)...
NameError: uninitialized constant Grackle
from grackle.rb:6
etc etc, every time Grackle gets called a similar error occurs

after it tries to run the first line. This initial error then triggers a cascade of errors.

I have installed the grackle gem. What's going on here?

boulder_ruby
  • 38,457
  • 9
  • 79
  • 100
  • 1
    Rename your file `grackle.rb` to something else like `foo.rb`, then try again. Too many `grackle` files here. Let's start by making sure you are not getting confused about what ruby is loading when you `require 'grackle'`. – Casper Jun 08 '12 at 19:07

1 Answers1

1

You are running ruby 1.8. You need to require 'rubygems' before you can require 'grackle' (the gem).

You are confusing yourself because you have a file named grackle.rb in your current directory, but you did not initialize rubygems in your irb first, so require 'grackle' will load the local grackle.rb instead of the gem.

Casper
  • 33,403
  • 4
  • 84
  • 79