kylejginavan / youtube_it

An object-oriented Ruby wrapper for the YouTube GData API
http://groups.google.com/group/ruby-youtube-library
595 stars 223 forks source link

(ArgumentError) "wrong number of arguments (2 for 0..1)" #159

Closed gabrielrios closed 11 years ago

gabrielrios commented 11 years ago

I've updated my application to ruby 2, and started receiving the following error everytime i tried to upload an video

wrong number of arguments (2 for 0..1)
  /home/deployer/apps/xxx/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'

It seems to me that something changed with net/http on ruby 2 so ChainIO#read is receiving two arguments.

Tried to inspect for more details but i'm not really sure on how all those works, what i can add is that the arguments passed to read were: (16384, "")

ylluminate commented 11 years ago

Seeing this here too. Could we please get some support on this?

kylejginavan commented 11 years ago

I will have this fixed in the next couple of days.

On Thu, Apr 18, 2013 at 2:32 PM, George Plymale notifications@github.comwrote:

Seeing this here too. Could we please get some support on this?

— Reply to this email directly or view it on GitHubhttps://github.com/kylejginavan/youtube_it/issues/159#issuecomment-16600188 .

ylluminate commented 11 years ago

Thanks. It has shut down our usual postings and we've been getting complaints for the past week so that will be fantastic.

gabrielrios commented 11 years ago

https://twitter.com/AkitaOnRails/status/326798607527342080

This seems related to this problem.

chebyte commented 11 years ago

hi there, yeap as @gabrielrios said this is a ruby 2.0 bug so you have to wait the fix from ruby or patch this as akita says

cheers!

scaryguy commented 11 years ago

So what? Isn't there a work around to use youtube_it with ruby 2.0 at this time?? This must be a joke?

ylluminate commented 11 years ago

I agree, this is pretty frustrating and there should be some kind of a work around. Further the new ruby 2 update was released recently, does it help? We had to go back to 1.9.3 here over this crap.

chebyte commented 11 years ago

the thing guys is that the problem is in ruby 2.0 core, so we have to wait for ruby patch or you can path by your self your ruby version, cause if we want to fix the gem, we have to change to http/client so I think that this change is not significant when the bug is external

scaryguy commented 11 years ago

@chebyte, the bug mentioned at Akita's tweet seems to be closed already: https://bugs.ruby-lang.org/issues/7924

is there a way to implement those changes to a Ruby 2.0.0-p0 installed via RVM?

Or with another saying, have you tried if this bug fixes the problem argued here?

ylluminate commented 11 years ago

Well unfortunately @chebyte we did patch ruby and still ran into the issue oddly enough. @scaryguy we run on RVM and so I would suggest that "YMMV" and not to hold out too much hope on that resolving the problem. That is why I asked about the new 2.0 patch level. If that is known to fix the problem, we'll give it another go, else we're going to wait until some folks report back success here as it was a very fruitless and frustrating experience for us.

scaryguy commented 11 years ago

Thanks for info @ylluminate, so @chebyte I think this statement makes reopenning of this issue is a must.

chebyte commented 11 years ago

oka let me check again

scaryguy commented 11 years ago

@chebyte have you got a clue about the issue? Excuse my unpatience but I'm just in the middle of an important project and I do need a video upload gem for YouTube. If you don't think the issue will be resolved before a long time, could you please recommend me another gem or method?

@ylluminate , how do you fulfil your video upload needs to YouTube without this gem? Do you have a plan B or an alternative?

Thank you

chebyte commented 11 years ago

@scaryguy I have the fix, I think that I going to finish today, btw if you are getting money with this gem I invite you to donate to the gem

http://pledgie.com/campaigns/16746

I'm helping to you and you can help with children how needs help(we are sending all donations to one foundation)

the same for the rest

thanks

scaryguy commented 11 years ago

Hi @chebyte, after reading your reply I asked to my boss if he can make some donation and he said OK :) $10 is not so much but consider it as a token of our good will :) Our CC holder will make transfer today I think.

I would really appreciate faster you finish and commit.

I'll be waiting for your good news/

Thank you again.

scaryguy commented 11 years ago

@chebyte , I saw you commited changes for 2.0 support thank you, but I'm unable to update my existing youtube_it gem :|

When I try bundle upate or gem update youtube_it nothing changes.

My version still looks as 2.2.1.

Any idea about this?

chebyte commented 11 years ago

the gem is done but I dont make the new release cause I'm seeing why tests are failing in travis service, but in local is working perfect, I think that today I going to push the new release, while you can use from github

gem "youtube_it", :git => git@github.com:kylejginavan/youtube_it.git

scaryguy commented 11 years ago

Thanks for reply @chebyte but I'm getting this error with the latest release you sent:

UploadError: Missing end boundary in multipart body.
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/bundler/gems/youtube_it-eb5058bd9379/lib/youtube_it/middleware/faraday_youtubeit.rb:27:in `on_complete'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/faraday-0.8.7/lib/faraday/response.rb:9:in `block in call'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/faraday-0.8.7/lib/faraday/response.rb:63:in `on_complete'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/bundler/gems/youtube_it-eb5058bd9379/lib/youtube_it/middleware/faraday_authheader.rb:17:in `call'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/faraday-0.8.7/lib/faraday/connection.rb:112:in `post'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/bundler/gems/youtube_it-eb5058bd9379/lib/youtube_it/request/video_upload.rb:92:in `upload'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/bundler/gems/youtube_it-eb5058bd9379/lib/youtube_it/client.rb:117:in `video_upload'
    from (irb):5
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start'
    from /Users/scaryguy/.rvm/gems/ruby-2.0.0-p0@sts/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
chebyte commented 11 years ago

what is the code is that you running?

scaryguy commented 11 years ago

Oh sorry, I've seen your reply lately @chebyte .

I ran this command:

client.video_upload(File.open("/Users/scaryguy/sts_videos/proress.mov"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test])

chebyte commented 11 years ago

so you have something wrong, the gem is working as expected even pass all tests, see my example

http://pastie.org/private/si0t5r7zubgss19dvoeva

I'm using

03:07 PM $ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
gabrielrios commented 11 years ago

Thank you. gotta try it when have a time here.

facetoe commented 11 years ago

I'm still getting this error. I've tried using 1.9.7 and 2.00 with no luck. This is the code I'm using:

require 'youtube_it'

client = YouTubeIt::Client.new(:username => "xxx", :password =>  "xxx", :dev_key => "xxx")
client.video_upload(File.open("/home/facetoe/.webcamData/dailyVids/18-06-13.MOV"), :title => "test",:description => 'some description', :category => 'People',:keywords => %w[cool blah test])

Results in:

/home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/youtube_it-2.3.1/lib/youtube_it/middleware/faraday_youtubeit.rb:27:in `on_complete': Missing end boundary in multipart body. (UploadError)
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/faraday-0.8.7/lib/faraday/response.rb:9:in `block in call'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/faraday-0.8.7/lib/faraday/response.rb:63:in `on_complete'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/faraday-0.8.7/lib/faraday/response.rb:8:in `call'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/youtube_it-2.3.1/lib/youtube_it/middleware/faraday_authheader.rb:17:in `call'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/faraday-0.8.7/lib/faraday/connection.rb:247:in `run_request'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/faraday-0.8.7/lib/faraday/connection.rb:112:in `post'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/youtube_it-2.3.1/lib/youtube_it/request/video_upload.rb:92:in `upload'
from /home/facetoe/.rvm/gems/ruby-2.0.0-p0/gems/youtube_it-2.3.1/lib/youtube_it/client.rb:117:in `video_upload'

It is very strange as last night I ran a test and it worked perfectly.

chrosciu commented 11 years ago

@facetoe: See comments in #167