Python Forum

Full Version: [Errno11004] Get addrinfo failed with urlopen
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello All,

I'm new to python development and using python version Python 2.7.13 , basically im trying to open a url but I get an error. Please supoort me on what the issue here is.
Code Snippet:
import urllib2
response = urllib2.urlopen('python.org') (I have removed the http link intenationally since i was not allowed to post the link)
Issue:
.......
 File "C:\Python27\lib\urllib2.py", line 1198, in do_open
   raise URLError(err)
URLError: <urlopen error [Errno 11004] getaddrinfo failed>

Thanks!
Prashanth
Here's the source: https://github.com/python/cpython/blob/2...2.py#L1196
Here's a description of the Window's Socket Error: https://msdn.microsoft.com/en-us/library...WSANO_DATA

The error is unrelated to urllib2, and is a socket error.  That error indicates that dns returned a result, but that there's no ip addresses associated with it.  Try again with 'www.' in front, or with a protocol.  
OR: check if you're using a proxy (environment variable http_proxy or https_proxy), and either stop using it, or start using a different one.

Also, the requests module is much easier to work with than urllib2 (but that's beside the point).
same problem for me when the network is down.