Issue in using Twitter API from Ruby - ruby

I am new bee to twitter API and MongoDb. I am trying out a ruby example from the book 'MongoDb In Action', Chapter-3 which connects to Twitter and gets feeds based on given tags. I have done the ruby set up as suggested. I am getting the following exception, which I think is related to ruby set up. Any hint is highly appreciated.
/usr/lib/ruby/1.9.1/net/http.rb:762:in `initialize': execution expired (Twitter::Error::ClientError)
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `open'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /usr/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from /usr/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /usr/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /usr/lib/ruby/1.9.1/net/http.rb:1284:in `request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:75:in `perform_request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:38:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request/url_encoded.rb:14:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request/multipart.rb:13:in `call'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/request/multipart_with_file.rb:14:in `call'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:112:in `post'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:108:in `request'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:72:in `post'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/utils.rb:82:in `object_from_response'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/oauth.rb:24:in `token'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:96:in `block in request_setup'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:102:in `block in get'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:243:in `block in run_request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:258:in `block in build_request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request.rb:35:in `block in create'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request.rb:34:in `tap'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/request.rb:34:in `create'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:254:in `build_request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:239:in `run_request'
from /var/lib/gems/1.9.1/gems/faraday-0.8.7/lib/faraday/connection.rb:100:in `get'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:108:in `request'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/client.rb:66:in `get'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/utils.rb:82:in `object_from_response'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter/api/search.rb:32:in `search'
from /var/lib/gems/1.9.1/gems/twitter-4.8.1/lib/twitter.rb:60:in `method_missing'
from /home/hadoop/archiver.rb:27:in `save_tweets_for'
from /home/hadoop/archiver.rb:21:in `update'
from update.rb:5:in `block in <main>'
from update.rb:3:in `each'
from update.rb:3:in `<main>'

The book you are reading was printed in 2011 and appears to use APIv1 which has recently been depreciated by twitter.
https://dev.twitter.com/docs/faq#17750
You'll need to set up oauth and I suggest you start with the twitter gem documentation.
https://github.com/sferik/twitter

Related

Ruby Sinatra getting Net::ReadTimeout - Net::ReadTimeout

Bellow are some parts of my code:
class VizApp < Sinatra::Base
get '/rubygems' do
#process_downloads_days = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_days_process', timeout: 180)
#version_downloads = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads')
#version_downloads_days = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_days')
#version_downloads_stack = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_stack')
#version_downloads_nest_drilldown = HTTParty.get('http://localhost:4567/api/v1/rubygems/version_downloads_nest')
erb :rubygems
end
What I do is calling the api that I wrote in the same project. When I using WEBrick as my web server, everything goes ok. However, when I change the web server to Thin, I get following error:
Net::ReadTimeout - Net::ReadTimeout: /Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:158:in `rescue in rbuf_fill'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:152:in `rbuf_fill'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:134:in `readuntil'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/protocol.rb:144:in `readline'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http/response.rb:39:in `read_status_line'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http/response.rb:28:in `read_new'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1423:in `block in transport_request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1420:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1420:in `transport_request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1393:in `request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1386:in `block in request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:853:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/2.3.0/net/http.rb:1384:in `request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty/request.rb:117:in `perform'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty.rb:545:in `perform_request'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty.rb:476:in `get'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/httparty-0.13.7/lib/httparty.rb:583:in `get'
/Users/chenlizhan/Desktop/Lee/Projects/repo-miner/visualization/app.rb:39:in `block in <class:VizApp>'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1610:in `block in compile!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `[]'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `block (3 levels) in route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:993:in `route_eval'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:974:in `block (2 levels) in route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1014:in `block in process_route'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1012:in `process_route'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:972:in `block in route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in `each'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:971:in `route!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1084:in `block in dispatch!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1081:in `dispatch!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `block in call!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `block in invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1066:in `invoke'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:906:in `call!'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:894:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/show_exceptions.rb:21:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:181:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:2021:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `block in call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1795:in `synchronize'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:1486:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/tempfile_reaper.rb:15:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/lint.rb:49:in `_call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/lint.rb:37:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/showexceptions.rb:24:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/commonlogger.rb:33:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/chunked.rb:54:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run_machine'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:187:in `run'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/handler/thin.rb:19:in `run'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/lib/rack/server.rb:147:in `start'
/Users/chenlizhan/.rvm/rubies/ruby-head/lib/ruby/gems/2.3.0/gems/rack-1.6.4/bin/rackup:4:in `<top (required)>'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/rackup:23:in `load'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/rackup:23:in `<main>'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `eval'
/Users/chenlizhan/.rvm/gems/ruby-head/bin/ruby_executable_hooks:15:in `<main>'
Anyone has the similar problems as me? Please give me a help, thanks!
I would create a thin.yml file within /config and then set timeout: 90 or play around with a value that you find best.
You can then specify the config file when you execute thin via thin -C config/thin.yml

RHC setup gives mkdir error

I am trying to add an openshift origin server for the first time. using :
rhc setup --server my.server.adr
but I get this error when it comes to Generate the token.
Generating an authorization token for this client ... C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:252:in `mkdir': No such file or directory #dir_s_mkdr - U: (Errno::ENOENT)
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:252:in `fu_mkdir'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:226:in `block (2 levels) in mkdir_p'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:224:in `reverse_each'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:224:in `block in mkdir_p'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:210:in `each'
from C:/Ruby22-x64/lib/ruby/2.2.0/fileutils.rb:210:in `mkdir_p'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/auth/token_store.rb:34:in `[]='
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/auth/token_store.rb:14:in `put'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/auth/token.rb:50:in `save'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:243:in `block in login_stage'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/highline_extensions.rb:190:in `call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/highline_extensions.rb:190:in `section'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/highline_extensions.rb:204:in `paragraph'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/helpers.rb:337:in `block (2 levels) in <module:Helpers>'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:237:in `login_stage'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:67:in `block in run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:65:in `each'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/wizard.rb:65:in `run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands/setup.rb:57:in `run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands.rb:294:in `execute'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/commands.rb:285:in `block (3 levels) in to_commander'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/command.rb:180:in `call'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/command.rb:155:in `run'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/runner.rb:421:in `run_active_command'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/command_runner.rb:72:in `run!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/commander-4.2.1/lib/commander/delegates.rb:8:in `run!'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/lib/rhc/cli.rb:37:in `start'
from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rhc-1.35.3/bin/rhc:20:in `<top (required)>'
from C:/Ruby22-x64/bin/rhc:23:in `load'
from C:/Ruby22-x64/bin/rhc:23:in `<main>'
I can't find what's wrong, and what is the - U: after #dir_s_mkdir ?
any help or hint would be apreciated.
Thank you for your answers, I think it's a compatibility problem as you said with ruby 2.2
I didn't use another ruby version but I used a docker container instead.

Failure to upload file to S3 using Ruby

I'm uploading a collection of files to S3 (53 files) but towards the end, around 45 files, this starts to happen:
Connection reset by peer
E, [2015-05-07T10:43:03.361617 #8542] ERROR -- : /home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/openssl/buffering.rb:326:in `syswrite'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/openssl/buffering.rb:326:in `do_write'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/openssl/buffering.rb:344:in `write'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/protocol.rb:211:in `write0'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/protocol.rb:185:in `block in write'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/protocol.rb:202:in `writing'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/protocol.rb:184:in `write'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http/generic_request.rb:187:in `send_request_with_body'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http/generic_request.rb:120:in `exec'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/aws-sdk-v1-1.64.0/lib/aws/core/http/patch.rb:27:in `block in new_transport_request'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/aws-sdk-v1-1.64.0/lib/aws/core/http/patch.rb:26:in `catch'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/aws-sdk-v1-1.64.0/lib/aws/core/http/patch.rb:26:in `new_transport_request'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http.rb:1383:in `request'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http.rb:1376:in `block in request'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http.rb:853:in `start'
/home/mauricio/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http.rb:1374:in `request'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/httparty-0.13.3/lib/httparty/request.rb:98:in `perform'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/httparty-0.13.3/lib/httparty.rb:539:in `perform_request'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/httparty-0.13.3/lib/httparty.rb:501:in `put'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/httparty-0.13.3/lib/httparty.rb:589:in `put'
/home/mauricio/.rvm/gems/ruby-2.2.0/bundler/gems/neat-cli-44b0902e2c95/lib/neat_cli/client.rb:318:in `block in finish_upload'
/home/mauricio/.rvm/gems/ruby-2.2.0/bundler/gems/neat-cli-44b0902e2c95/lib/neat_cli/client.rb:698:in `call'
/home/mauricio/.rvm/gems/ruby-2.2.0/bundler/gems/neat-cli-44b0902e2c95/lib/neat_cli/client.rb:698:in `validating_response'
/home/mauricio/.rvm/gems/ruby-2.2.0/bundler/gems/neat-cli-44b0902e2c95/lib/neat_cli/client.rb:317:in `finish_upload'
/home/mauricio/.rvm/gems/ruby-2.2.0/bundler/gems/neat-cli-44b0902e2c95/lib/neat_cli/client.rb:327:in `v4_upload'
/home/mauricio/projects/ruby/spi-test/lib/spitest/webapp.rb:17:in `block in upload'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/retriable-2.0.2/lib/retriable.rb:53:in `block in retriable'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/retriable-2.0.2/lib/retriable.rb:48:in `each'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/retriable-2.0.2/lib/retriable.rb:48:in `with_index'
/home/mauricio/.rvm/gems/ruby-2.2.0/gems/retriable-2.0.2/lib/retriable.rb:48:in `retriable'
/home/mauricio/projects/ruby/spi-test/lib/spitest/webapp.rb:15:in `upload'
/home/mauricio/projects/ruby/spi-test/lib/spitest/launcher.rb:44:in `block (3 levels) in upload_to_all_dests'
/home/mauricio/projects/ruby/spi-test/lib/spitest/thread_pool.rb:21:in `call'
/home/mauricio/projects/ruby/spi-test/lib/spitest/thread_pool.rb:21:in `block (2 levels) in start'
I have already changed the TCP buffers but this is still causing issues when uploading lots of files.
Any idea how to fix this?
I'm running Ubuntu 14.04 and Ruby 2.2.0p0.

Timeout::Error for selenium while loading heavy page

I'm facing a Timeout::Error issue while loading heavy web page. I observed that even if I added an implicit wait call #driver.manage.timeouts.implicit_wait = 300, a timeout error is thrown before 300 seconds - it's thrown in around 60-70 seconds.
Error thrown is -
Timeout::Error
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:2562:in `read_status_line'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1293:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1286:in `block in request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:745:in `start'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/net/http.rb:1284:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in `response_for'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in `request'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:576:in `execute'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:99:in `get'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/navigation.rb:14:in `to'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:108:in `get'
backlot.rb:17:in `test_backlot'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:949:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit/testcase.rb:17:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:787:in `block in _run_suite'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:780:in `map'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:780:in `_run_suite'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:565:in `block in _run_suites'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:563:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:563:in `_run_suites'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:746:in `_run_anything'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:909:in `run_tests'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:896:in `block in _run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:895:in `each'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:895:in `_run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:21:in `run'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
try using gem fakeweb
FakeWeb is a helper for faking web requests in Ruby. It works at a global level, without modifying code or writing extensive stubs.
In GEMFILE write
gem 'fakeweb', :require => false
require 'fakeweb'
use above statement in your file
Hope this would work..
I believe the original issue isn't with Selenium and your question is answered here:
'rescue in rbuf_fill': Timeout::Error (Timeout::Error)

Fog creating spot request fails

Here's the paramters I'm passing to connection.spot_requests.create().
{:price=>"1", :image_id=>"ami-63be790a", :groups=>["mcsl-web", "default"], :flavor_id=>"m1.xlarge", :key_name=>"mcsl", :availability_zone=>"us-east-1a", :block_device_mapping=>[{"DeviceName"=>"/dev/sda1", "Ebs.VolumeSize"=>"8", "Ebs.DeleteOnTermination"=>"true"}]}
Here's the error:
/Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/compute/parsers/aws/spot_instance_requests.rb:37:in `[]=': can't convert String into Integer (Excon::Errors::SocketError)
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/compute/parsers/aws/spot_instance_requests.rb:37:in `end_element'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/nokogiri-1.5.0/lib/nokogiri/xml/sax/document.rb:127:in `end_element_namespace'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/nokogiri-1.5.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `native_write'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/nokogiri-1.5.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `write'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/core/connection.rb:16:in `block in request'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.6.6/lib/excon/response.rb:46:in `parse'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/excon-0.6.6/lib/excon/connection.rb:174:in `request'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/core/connection.rb:20:in `request'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/compute/aws.rb:280:in `request'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/compute/requests/aws/request_spot_instances.rb:77:in `request_spot_instances'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/compute/models/aws/spot_request.rb:76:in `save'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180#global/gems/fog-0.11.0/lib/fog/core/collection.rb:50:in `create'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/knife-ec2-0.5.6/lib/chef/knife/ec2_server_create.rb:259:in `run'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/knife.rb:391:in `run_with_pretty_exceptions'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/knife.rb:166:in `run'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/lib/chef/application/knife.rb:128:in `run'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/gems/chef-0.10.4/bin/knife:25:in `<top (required)>'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/bin/knife:19:in `load'
from /Users/wedtm/.rvm/gems/ruby-1.9.2-p180/bin/knife:19:in `<main>'
This is a bug in fog. I just ran into it myself and wrote a quick patch. You can find my patch at https://github.com/geemus/fog/pull/553

Resources