[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

IO::write() throws Invalid Argument with HTTP::get

Chris Cera

2/11/2008 3:23:00 AM

Hi everyone,

I have a <15 line snippet below that fails when downloading a particular
60+MB file. I have tested it with other files >60MB and it works. This
one in particular is gives me trouble everytime. Any help is greatly
appreciated. -Chris

-----------------------------------------------------------------
#!/bin/ruby

url = 'http://blog.vuzit.com/07EarlyYear...
uri = URI.parse(url)

Net::HTTP.start(uri.host, 80) do |http|
response = http.get(uri.path)
mystr = response.body.to_s

File.open('result', 'wb') {|f|
count = f.write mystr
}
end
-----------------------------------------------------------------
[2152] [c@insomnio:~/hovitate/trunk/vuzit]
$ ruby test-dload.rb
test-dload.rb:11:in `write': Invalid argument - result (Errno::EINVAL)
from test-dload.rb:11
from test-dload.rb:10:in `open'
from test-dload.rb:10
from c:/ruby/lib/ruby/1.8/net/http.rb:543:in `start'
from c:/ruby/lib/ruby/1.8/net/http.rb:440:in `start'
from test-dload.rb:6
--
Posted via http://www.ruby-....