title: IOError: [Errno socket error] [Errno 11004] getaddrinfo failed
body: <p>I am beginner python prorammer. With 2.7.2, Windows 7, built-in interpreter, and three libraries. I am trying to do this, with error. I appreciate any help?</p>
  
  <pre><code>import os
  import urllib
  import socket
  
  DISNEY_URL = 'http://www.sec.gov/Archives/edgar/data/1001039/000119312511321340/dis-20111001.xml'
  #Neither of these seem to work when opening with urllib.urlopen becaue of the error:
  #I/O error(socket error): [Errno 11004] getaddrinfo failed
  
  DISNEY_LOCAL = 'file://C:/Users/Nate/Desktop/Education/python_education/xbrlnexusfiles/xbrlfiles/dis-20111001.xml'
  DISNEY_LOCAL_NONE = 'file://C:/Users/Nate/Desktop/Education/python_education/xbrlnexusfiles/xbrlfiles/dis.txt'
  
  
  class SECFilingPackage(object):
  
      def __init__ (self, SEC_URL):
          URLFilePath, URLFileExt = os.path.splitext(SEC_URL)
          try:
              urllib.urlopen(SEC_URL)
          except IOError as (errno, strerror):
              print "I/O error({0}): {1}".format(errno, strerror)
              #This error throws, see it copied above;
  
  DisneyPackage = SECFilingPackage(DISNEY_LOCAL_NONE)
  </code></pre>
  
  <p>I get this error:
  I/O error(socket error):</p>
  
  <blockquote>
    <p>[Errno 11004] getaddrinfo failed</p>
  </blockquote>
  
  <p>Yes the text file exists at that location. The contents of the text file is "Nothing"</p>
  
  <p>The stack trace says the last call was line 516 in <code>open_ftp</code> <code>C:/Python27/Lib/urllib.py</code>:</p>
  
  <pre><code>host = socket.gethostbyname(host)
  IOError: [Errno socket error] [Errno 11004] getaddrinfo failed
  </code></pre>
  
  <p>I could open URLs fine, so I don't think it's a <a href="https://stackoverflow.com/questions/4847649/opening-websites-using-urllib2-from-behind-corporate-firewall-11004-getaddrinf">proxy/firewall issue</a> (nor do I understand that really)</p>
  
  <p>And I don't understand what <a href="https://stackoverflow.com/questions/4126023/python-gaierror-errno-11004-getaddrinfo-failed">newlines or ENDs</a> might have to do with it. </p>
  
  <p>I believe it should work because of the <a href="http://docs.python.org/library/urllib.html" rel="nofollow noreferrer">urllib reference:</a></p>
  
  <blockquote>
    <p>If the URL does not have a scheme identifier, or if it has file: as
    its scheme identifier, this opens a local file (without universal
    newlines); otherwise it opens a socket to a server somewhere on the
    network.</p>
  </blockquote>
  
  <p>(I think this just means someone who expects universal newlines already converted there, would be disappointed. </p>
  
  <p>Note I also dispute the part about "if it does not have a scheme identifier", because if I don't precede the strings with <code>file://</code> I get</p>
  
  <blockquote>
    <p>IOError: [Errno url error] unknown url type: 'c')</p>
  </blockquote>
  
  <p>I want to "learn to fish" so to speak, can anyone tell me is there a way I could debug into the <code>urllib.py</code> to at least understand these values? Can I do it with eclipse? It always seems to force me into a project.</p>