jefflinwood / Tweeter-Keeper

Ruby and MongoDB integration for the back end of any new Twitter analytics/processing project
32 stars 9 forks source link

undefined method `has_key?' #3

Open satishv opened 12 years ago

satishv commented 12 years ago

I am getting the following error, when I ran this application. thoughts?

<Twitter::Status:0x00000106790250 @attrs={:in_reply_to_status_id_str=>nil, :contributors=>nil, :place=>nil, :in_reply_to_screen_name=>nil, :text=>"【大津いじめ自殺】体育祭での暴行、女性教諭が目撃し注意していたことが判明 http://t.co/hz8DYMWt", :favorited=>false, :in_reply_to_user_id_str=>nil, :coordinates=>nil, :geo=>nil, :retweet_count=>0, :created_at=>"Fri Jul 13 06:35:37 +0000 2012", :source=>"<a href=\"http://twitter.com/tweetbutton\" rel=\"nofollow\">Tweet Button", :in_reply_to_user_id=>nil, :in_reply_to_status_id=>nil, :possibly_sensitive_editable=>true, :retweeted=>false, :id_str=>"223666977305133058", :truncated=>false, :possibly_sensitive=>false, :user=>{:favourites_count=>2, :friends_count=>1535, :profile_background_color=>"0099B9", :following=>nil, :profile_background_tile=>false, :profile_background_image_url_https=>"https://si0.twimg.com/images/themes/theme4/bg.gif", :followers_count=>953, :profile_image_url=>"http://a0.twimg.com/profile_images/1829306928/88b3b902_normal.jpg", :contributors_enabled=>false, :geo_enabled=>false, :created_at=>"Fri Aug 05 04:11:55 +0000 2011", :profile_sidebar_fill_color=>"95E8EC", :description=>"メタラー、自転車好き、主にまとめサイトめぐり。", :listed_count=>1, :follow_request_sent=>nil, :time_zone=>"Tokyo", :url=>nil, :verified=>false, :profile_sidebar_border_color=>"5ED4DC", :default_profile=>false, :show_all_inline_media=>true, :is_translator=>false, :notifications=>nil, :profile_use_background_image=>true, :protected=>false, :profile_image_url_https=>"https://si0.twimg.com/profile_images/1829306928/88b3b902_normal.jpg", :location=>"Tokyo 東京", :id_str=>"348871530", :profile_text_color=>"3C3940", :name=>"アギヤマ", :statuses_count=>912, :profile_background_image_url=>"http://a0.twimg.com/images/themes/theme4/bg.gif", :id=>348871530, :default_profile_image=>false, :lang=>"ja", :utc_offset=>32400, :profile_link_color=>"0099B9", :screen_name=>"Agyarma"}, :id=>223666977305133058, :entities=>{:user_mentions=>[], :urls=>[{:display_url=>"itainewssokuhou.seesaa.net/article/280747…", :indices=>[37, 57], :url=>"http://t.co/hz8DYMWt", :expanded_url=>"http://itainewssokuhou.seesaa.net/article/280747462.html"}], :hashtags=>[]}}, @urls=[#<Twitter::Entity::Url:0x00000106790160 @attrs={:display_url=>"itainewssokuhou.seesaa.net/article/280747…", :indices=>[37, 57], :url=>"http://t.co/hz8DYMWt", :expanded_url=>"http://itainewssokuhou.seesaa.net/article/280747462.html"}>]>

223666977305133058 - 【大津いじめ自殺】体育祭での暴行、女性教諭が目撃し注意していたことが判明 http://t.co/hz8DYMWt - 2012-07-12 23:35:37 -0700 Error received NoMethodError: undefined method has_key?' for #<String:0x000001067a4e08> /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/bson-1.6.4/lib/bson/types/object_id.rb:93:increate_pk' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/mongo-1.6.4/lib/mongo/collection.rb:351:in block in insert' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/mongo-1.6.4/lib/mongo/collection.rb:351:incollect!' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/mongo-1.6.4/lib/mongo/collection.rb:351:in insert' tweets.rb:59:inblock in

' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/tweetstream-2.0.1/lib/tweetstream/client.rb:430:in block in connect' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:274:incall' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:274:in invoke_callback' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:129:inhandle_stream' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:174:in block in on_body' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:173:ineach' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:173:in on_body' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:71:in<<' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/em-twitter-0.1.4/lib/em-twitter/connection.rb:71:in receive_data' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:187:inrun_machine' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:187:in run' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/tweetstream-2.0.1/lib/tweetstream/client.rb:359:instart' /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/tweetstream-2.0.1/lib/tweetstream/client.rb:117:in filter' tweets.rb:53:in
' ^C/Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:187:in run_machine': Interrupt from /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:187:inrun' from /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/tweetstream-2.0.1/lib/tweetstream/client.rb:359:in start' from /Users/satish/.rvm/gems/ruby-1.9.3-p0/gems/tweetstream-2.0.1/lib/tweetstream/client.rb:117:infilter' from tweets.rb:53:in `
'

tibbon commented 11 years ago

I too ran into this. I think its because you can't just insert a Ruby object straight into Mongo. Needs to be turned to Json or something else.