Ruby/Qte普及委員会 /usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError)

XREAAD
Create  Edit  Diff  FrontPage  Index  Search  Changes  History  RSS  Login

山口と申します。

以下の環境で、 yama@roswell:~/tmp$ uname -a Linux roswell 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 i686 i686 i386 GNU/Linux yama@roswell:~/tmp$ ruby --version ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

下記のプログラムを実行したところ...

yama@roswell:~/tmp$ cat Google.rb require 'rubygems' require 'mechanize'

agent = Mechanize.new page = agent.get('http://google.com/') yama@roswell:~/tmp$ ruby Google.rb /usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError?)

       from /usr/lib/ruby/1.8/net/http.rb:560:in `open'
       from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
       from /usr/lib/ruby/1.8/timeout.rb:53:in `timeout'
       from /usr/lib/ruby/1.8/timeout.rb:101:in `timeout'
       from /usr/lib/ruby/1.8/net/http.rb:560:in `connect'
       from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
       from /usr/lib/ruby/1.8/net/http.rb:548:in `start'
       from /usr/lib/ruby/1.8/mechanize.rb:527:in `fetch_page'
       from /usr/lib/ruby/1.8/mechanize.rb:259:in `get'
       from Google.rb:5

となり、

http://d.hatena.ne.jp/takatoh/20070522/http_proxy を軽く参考にし、

yama@roswell:~/tmp$ export HTTP_PROXY=http://proxy.company.co.jp:10080/ yama@roswell:~/tmp$ ruby Google.rb /usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError?) ... yama@roswell:~/tmp$ export HTTP_PROXY=http://proxy.company.co.jp:10080 yama@roswell:~/tmp$ ruby Google.rb /usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError?) ... yama@roswell:~/tmp$ set http_proxy=http://proxy.company.co.jp:10080/ yama@roswell:~/tmp$ ruby Google.rb /usr/lib/ruby/1.8/net/http.rb:560:in `initialize': getaddrinfo: Name or service not known (SocketError?) ...

といずれも同じようにエラーになります。 どこが悪いのかご教示いただけますでしょうか? よろしくお願いします。

Last modified:2012/08/06 16:48:59
Keyword(s):
References: