我有一个应用程序,它的任务是抓取一个网站,然后将一段视频发布到 youtube,并抓取一些信息。
将应用程序更新到 ruby 2 后,youtube 上传停止工作并开始显示以下内容:
(ArgumentError) "wrong number of arguments (2 for 0..1)"
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it 2.1.13/lib/youtube_it/chain_io.rb:66:in `read'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/generic_request.rb:202:in `copy_stream'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/generic_request.rb:202:in `send_request_with_body_stream'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http/generic_request.rb:132:in `exec'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1403:in `block in transport_request'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1402:in `catch'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1375:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:25:in `block in request_with_newrelic_trace'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/cross_app_tracing.rb:39:in `trace_http_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:24:in `request_with_newrelic_trace'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1368:in `block in request'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:851:in `start'
/usr/local/rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/net/http.rb:1366:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:25:in `block in request_with_newrelic_trace'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/cross_app_tracing.rb:39:in `trace_http_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/newrelic_rpm-3.6.0.83/lib/new_relic/agent/instrumentation/net.rb:24:in `request_with_newrelic_trace'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:75:in `perform_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/adapter/net_http.rb:38:in `call'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it-2.1.13/lib/youtube_it/middleware/faraday_authheader.rb:17:in `call'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/faraday-0.8.7/lib/faraday/connection.rb:112:in `post'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it-2.1.13/lib/youtube_it/request/video_upload.rb:92:in `upload'
/home/deployer/apps/project/shared/bundle/ruby/2.0.0/gems/youtube_it-2.1.13/lib/youtube_it/client.rb:106:in `video_upload'
/home/deployer/apps/project/current/app/models/cme_event.rb:169:in `upload_on_youtube'
这是一个关于参数数量的简单愚蠢错误,这似乎是net/http 将两个参数而不是前一个参数传递给函数。我尝试通过添加额外的可选参数来更改youtube_it gem 上的代码,但仍然没有运气。
所以有人知道ruby 2 上的net/http可能会发生什么改变吗?