Hi everyone,
I have been trying to use urllib and am encountering problems. I have tried uninstalling Python and reinstalling and still it fails.
Below is the code that fails, I have other actual useful code that I want to use this for, but to simplify fault-finding I wrote this short bit of code and it failed too.
import urllib
print "hello"
f = urllib.urlopen("http://www.python.org").read()
print f
----
The output and errors I see are below:
hello
Traceback (most recent call last):
File "ped.py", line 908, in run_click
File "E:\Python\Urllib.py.py", line 3, in ?
f = urllib.urlopen("http://www.python.org").read()
File "c:\resource\urllib.py", line 43, in urlopen
return _urlopener.open(url)
File "c:\resource\urllib.py", line 123, in open
return getattr(self, name)(url)
File "c:\resource\urllib.py", line 229, in open_http
h.endheaders()
File "c:\resource\httplib.py", line 454, in endheaders
self._send_output()
File "c:\resource\httplib.py", line 405, in _send_output
self.send(msg)
File "c:\resource\httplib.py", line 385, in send
self.connect()
File "c:\resource\httplib.py", line 355, in connect
socket.SOCK_STREAM):
File "c:\resource\socket.py", line 229, in getaddrinfo
r_host = gethostbyname(host)
IOError: [Errno socket error] (0, 'getaddrinfo failed')
---
Any assistance would be really appreciated.
Lance


Reply With Quote




