4

I'm getting an error when ever I try to pull down a web page with urllib.urlopen. I've disabled windows firewall and my AV so its not that. I can access the pages in my browser. I even reinstalled python to rule out it being a broken urllib. Any help would be greatly appreciated.

>>> import urllib
>>> h = urllib.urlopen("http://www.google.com").read()

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    h = urllib.urlopen("http://www.google.com").read()
  File "C:\Python26\lib\urllib.py", line 86, in urlopen
    return opener.open(url)
  File "C:\Python26\lib\urllib.py", line 205, in open
    return getattr(self, name)(url)
  File "C:\Python26\lib\urllib.py", line 344, in open_http
    h.endheaders()
  File "C:\Python26\lib\httplib.py", line 904, in endheaders
    self._send_output()
  File "C:\Python26\lib\httplib.py", line 776, in _send_output
    self.send(msg)
  File "C:\Python26\lib\httplib.py", line 735, in send
    self.connect()
  File "C:\Python26\lib\httplib.py", line 716, in connect
    self.timeout)
  File "C:\Python26\lib\socket.py", line 514, in create_connection
    raise error, msg
IOError: [Errno socket error] [Errno 10061] No connection could be made because the target machine actively refused it
>>> 
7
  • works for me, probably you overloaded google with requests and they cut you off for a while Commented May 19, 2010 at 20:00
  • no its happening with any url I try to load. Commented May 19, 2010 at 20:01
  • oh, hmm. No proxy or something, or weird port voodoo in your firewall? Commented May 19, 2010 at 20:02
  • well, I turned off my software firewall. And my router cant be blocking it because I can access pages from my browser. What do you mean by proxy? is there somewhere proxy can be set in pythons configuration or something? Commented May 19, 2010 at 20:05
  • Are you using Linux? Try running strace python yourscript.pl and see what you get. Commented May 19, 2010 at 20:12

2 Answers 2

5

this could be the case:

Just found the problem I had set a proxy through internet options, that proxy went offline, and so did my python shell.

Sign up to request clarification or add additional context in comments.

1 Comment

Yup, that was it. Apparently Idle uses the proxy settings from internet options. Thanks a lot Mykhal
0

urllib is working just fine.

Try using ethereal (or some similar network sniffer) on your box to determine if the denial coming from your machine or a machine beyond.

1 Comment

It can't be a machine beyond, my browser can access the websites I'm trying. And its happening with every single website I try so its not some useragent problem or anything similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.