mudder
mudder

Reputation: 167

Problem with python urllib

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
>>> 

Upvotes: 4

Views: 4500

Answers (2)

mykhal
mykhal

Reputation: 19924

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.

Upvotes: 5

MikeyB
MikeyB

Reputation: 3360

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.

Upvotes: 0

Related Questions