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

C

Chris Cera

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/07EarlyYears.pdf'
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top