Python Forum
[Errno11004] Get addrinfo failed with urlopen - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: [Errno11004] Get addrinfo failed with urlopen (/thread-3813.html)



[Errno11004] Get addrinfo failed with urlopen - prashanth0988 - Jun-27-2017

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


RE: [Errno11004] Get addrinfo failed with urlopen - nilamo - Jun-27-2017

Here's the source: https://github.com/python/cpython/blob/2.7/Lib/urllib2.py#L1196
Here's a description of the Window's Socket Error: https://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx#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).


RE: [Errno11004] Get addrinfo failed with urlopen - iiooii - Aug-02-2018

same problem for me when the network is down.