Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:31:49+00:00 2026-05-28T16:31:49+00:00

I am beginner python prorammer. With 2.7.2, Windows 7, built-in interpreter, and three libraries.

  • 0

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?

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)

I get this error:
I/O error(socket error):

[Errno 11004] getaddrinfo failed

Yes the text file exists at that location. The contents of the text file is “Nothing”

The stack trace says the last call was line 516 in open_ftp C:/Python27/Lib/urllib.py:

host = socket.gethostbyname(host)
IOError: [Errno socket error] [Errno 11004] getaddrinfo failed

I could open URLs fine, so I don’t think it’s a proxy/firewall issue (nor do I understand that really)

And I don’t understand what newlines or ENDs might have to do with it.

I believe it should work because of the urllib reference:

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.

(I think this just means someone who expects universal newlines already converted there, would be disappointed.

Note I also dispute the part about “if it does not have a scheme identifier”, because if I don’t precede the strings with file:// I get

IOError: [Errno url error] unknown url type: ‘c’)

I want to “learn to fish” so to speak, can anyone tell me is there a way I could debug into the urllib.py to at least understand these values? Can I do it with eclipse? It always seems to force me into a project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:31:50+00:00Added an answer on May 28, 2026 at 4:31 pm

    Instead of file://<filename>, use file:///<filename (note the extra slash).

    Also, please note that urllib.urlopen has been deprecated, you should use urllib2.urlopen instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a beginner to Python trying to decode this javascript sequence. I'm not only
I am a beginner with Python and trying few programs. I have something like
I'm trying to get simple code working, unfortunately I'm a python beginner. My script
Python beginner >>> import oauth2 Traceback (most recent call last): File , line 1,
I am beginner in python and facing this problem. So how i can break
I'm a beginner in python and I'm trying to use a octal number in
I am a beginner at Python, and this is my first post, so don't
I am a python beginner and I am trying to average two NumPy 2D
Python beginner here, so I apologize if this question has a simple answer. (I
I am a beginner in python and cant understand why this is happening: from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.