urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>?

Sam Chan

So, My code is only 4 lines. I am trying to connect to a website, what I am trying to do after that is irrelevant because the error arised without the other codes.

import urllib.request
from bs4 import BeautifulSoup 

html=urllib.request.urlopen('http://python-data.dr-chuck.net/known_by_Fikret.html').read()
soup=BeautifulSoup(html,'html.parser')

and the error(succinctly summarized one):

for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed
During handling of the above exception, another exception occurred:
urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>

Here is what I have tried.

  1. I searched for the Error returned "urlopen error [Errno 11002]” on google and especially on stackoverflow, nothing helpful was returned(In fact there are not much question on this error 11002 was asked).
  2. So Then I try to replace the website argument(i.e. "http://python-data.dr-chuck.net/known_by_Fikret.html" ) inside the urlopen function with another website "http://www.pythonlearn.com/code/urllinks.py". And it worked just fine. No error comes up.
  3. So I guess this error must have something to do with this particular website per se. The website is somewhat dynamic, by which I mean its content will alter and change into another wholly different thing. But I have no more knowledge than just to descibe what I saw.

and the longer and full version of error:

Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 1240, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1083, in request
self._send_request(method, url, body, headers)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1128, in _send_request
self.endheaders(body)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1079, in endheaders
self._send_output(message_body)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 911, in _send_output
self.send(msg)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 854, in send
self.connect()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 826, in connect
(self.host,self.port), self.timeout, self.source_address)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 693, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/baiduyundownload/Tempo/Active/Python/Python Examples/Fileanalysis11111.py", line 4, in <module>
html=urllib.request.urlopen('http://python-data.dr-chuck.net/known_by_Fikret.html').read()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 162, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 465, in open
response = self._open(req, data)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 483, in _open
'_open', req)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 443, in _call_chain
result = func(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 1268, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 1242, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11002] getaddrinfo failed>
Burhan Khalid

This means that either your DNS system is not working correctly, or you have to use a proxy on your network and it isn't defined correctly.

If you need to use a proxy, set the environment variable HTTP_PROXY (and optionally, HTTPS_PROXY) to the correct configuration for your network. The format is http://proxy.example.com:80; if your proxy needs a username and password, you should pass it in, like this: http://username:[email protected]:80.

For DNS issues, try looking up the domain from the command line. Open a command prompt and type nslookup python-data.dr-chuck.net and see if it returns to you an IP address.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

urlopen error [Errno 11001] getaddrinfo failed

From Dev

urlopen error [Errno 11001] getaddrinfo failed?

From Dev

Python3 Wolframalpha Giving Error: urllib.error.URLError <urlopen error [Errno 101] Network is unreachable>

From Dev

urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

From Dev

URLError: urlopen error [Errno 2] No such file or directory

From Dev

urllib.error.URLError: <urlopen error unknown url type: 'https>

From Dev

urllib.error.URLError: <urlopen error no host given> python 3

From Dev

Python ex_setup.py urlopen error [Errno 11004] getaddrinfo failed

From Dev

open html in python: urllib.error.URLError: <urlopen error no host given>

From Dev

Scrapy gives URLError: <urlopen error timed out>

From Dev

SpaCy urllib.error.URLError during Installation

From Dev

python urlopen error [Errno 10060]

From Dev

python - getting error (urllib2.URLError) using pandas model

From Dev

Python urlopen IOError: [Errno socket error] [Errno 10060]

From Dev

python urllib got [Errno socket error]

From Dev

urllib HTTPS request: <urlopen error unknown url type: https>

From Dev

Python urllib2.urlopen returns a HTTP error 503

From Dev

gaierror: [Errno 11004] getaddrinfo failed

From Dev

(python) [Errno 11001] getaddrinfo failed

From Dev

(python) [Errno 11001] getaddrinfo failed

From Dev

What does "urlopen error [Errno -2] Name or service not known" mean?

From Dev

What causes "urlopen error [Errno 13] Permission denied" errors?

From Dev

Ambari 2.0 installation fails, "<urlopen error [Errno 111] Connection refused>"

From Dev

Ubuntu 19.10 <urlopen error [Errno -5] No address associated with hostname>

From Java

urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error

From Dev

Python 3.6.2 url.request.urlopen() urllib.error.HTTPError: HTTP Error 403: Forbidden

From Dev

socket.gaierror: Errno 11004 getaddrinfo failed

From Dev

ATA error: COMRESET failed (errno=-32)

From Java

php_network_getaddresses: getaddrinfo failed error in Docker's adminer

Related Related

  1. 1

    urlopen error [Errno 11001] getaddrinfo failed

  2. 2

    urlopen error [Errno 11001] getaddrinfo failed?

  3. 3

    Python3 Wolframalpha Giving Error: urllib.error.URLError <urlopen error [Errno 101] Network is unreachable>

  4. 4

    urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>

  5. 5

    URLError: urlopen error [Errno 2] No such file or directory

  6. 6

    urllib.error.URLError: <urlopen error unknown url type: 'https>

  7. 7

    urllib.error.URLError: <urlopen error no host given> python 3

  8. 8

    Python ex_setup.py urlopen error [Errno 11004] getaddrinfo failed

  9. 9

    open html in python: urllib.error.URLError: <urlopen error no host given>

  10. 10

    Scrapy gives URLError: <urlopen error timed out>

  11. 11

    SpaCy urllib.error.URLError during Installation

  12. 12

    python urlopen error [Errno 10060]

  13. 13

    python - getting error (urllib2.URLError) using pandas model

  14. 14

    Python urlopen IOError: [Errno socket error] [Errno 10060]

  15. 15

    python urllib got [Errno socket error]

  16. 16

    urllib HTTPS request: <urlopen error unknown url type: https>

  17. 17

    Python urllib2.urlopen returns a HTTP error 503

  18. 18

    gaierror: [Errno 11004] getaddrinfo failed

  19. 19

    (python) [Errno 11001] getaddrinfo failed

  20. 20

    (python) [Errno 11001] getaddrinfo failed

  21. 21

    What does "urlopen error [Errno -2] Name or service not known" mean?

  22. 22

    What causes "urlopen error [Errno 13] Permission denied" errors?

  23. 23

    Ambari 2.0 installation fails, "<urlopen error [Errno 111] Connection refused>"

  24. 24

    Ubuntu 19.10 <urlopen error [Errno -5] No address associated with hostname>

  25. 25

    urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error

  26. 26

    Python 3.6.2 url.request.urlopen() urllib.error.HTTPError: HTTP Error 403: Forbidden

  27. 27

    socket.gaierror: Errno 11004 getaddrinfo failed

  28. 28

    ATA error: COMRESET failed (errno=-32)

  29. 29

    php_network_getaddresses: getaddrinfo failed error in Docker's adminer

HotTag

Archive