Python 2.7.10 Win7(64位)OS URLError

时间:2015-06-02 02:55:50

标签: python dns urllib2

我尝试使用Python 2.7.10 Shell运行以下代码:

# encoding: utf8
import urllib2
import re
response=urllib2.urlopen("https://www.baidu.com/")
print response.read()

不幸的是,我收到了错误:

Traceback (most recent call last):
  File "C:\Users\Vivid\Desktop\LISA\datacrawling\ex.py", line 6, in <module>
    response=urllib2.urlopen("https://www.baidu.com/")
  File "D:\Program Files\Python2710\lib\urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "D:\Program Files\Python2710\lib\urllib2.py", line 431, in open
    response = self._open(req, data)
  File "D:\Program Files\Python2710\lib\urllib2.py", line 449, in _open
    '_open', req)
  File "D:\Program Files\Python2710\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "D:\Program Files\Python2710\lib\urllib2.py", line 1240, in https_open
    context=self._context)
  File "D:\Program Files\Python2710\lib\urllib2.py", line 1197, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 11004] getaddrinfo failed>

你对这个问题有什么看法吗?我已经被它抓住了很长时间......谢谢你!

0 个答案:

没有答案