From: Peter Hickman Date: 2010-08-17T22:43:41+09:00 Subject: Re: HTTP Downloader As an aside. Here's something to note when reporting errors. I saved your script as a file called fred.rb and ran it: /usr/local/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: nodename nor servname provided, or not known (SocketError) from /usr/local/lib/ruby/1.8/net/http.rb:560:in `open' from /usr/local/lib/ruby/1.8/net/http.rb:560:in `connect' from /usr/local/lib/ruby/1.8/timeout.rb:53:in `timeout' from /usr/local/lib/ruby/1.8/timeout.rb:93:in `timeout' from /usr/local/lib/ruby/1.8/net/http.rb:560:in `connect' from /usr/local/lib/ruby/1.8/net/http.rb:553:in `do_start' from /usr/local/lib/ruby/1.8/net/http.rb:542:in `start' from /usr/local/lib/ruby/1.8/net/http.rb:440:in `start' from fred.rb:12 The first line tells you what the problem is, however this is inside a library function and is probably not where the problem lies. Note the "from fred.rb: 12" at the bottom. That is where in your program the error actually occurred and is what you want to know. It is the line containing "Net::HTTP.start("#{site}") { |http|", which shows where ruby is having a problem. Sometimes these stack traces can get very long but the useful information tends to be at the top and bottom of the output. It is useful to provide these parts of a stack trace (you can trim out the middle if the trace is long) and the relevant lines of code around where the problem occurs. Such as 10 puts "The file will download into the directory this script is placed in." 11 12 Net::HTTP.start("#{site}") { |http| 13 resp = http.get("#{subURL}") 14 open("fun.jpg", "wb") { |file| This will help people help you.