我正在尝试进一步学习 Python,但遇到了障碍。我无法让 urllib2/urllib 正常工作。如果我这样做,response = urllib2.urlopen('http://python.org/')
我会收到此错误:
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
response = urllib2.urlopen('http://python.org/')
File "C:\Python27\lib\urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "C:\Python27\lib\urllib2.py", line 400, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 418, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1207, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python27\lib\urllib2.py", line 1177, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>
即使是类似的东西也会URL = "http://173.194.75.94"
给出f=urllib.urlopen(URL)
相同的错误,所以这不是 DNS 问题。我没有代理或防火墙。除了我的 Windows 默认防火墙,它像往常一样被禁用。即便如此,我还是将 python 和 pythonw.exe 添加到它的异常中。
任何线索如何解决这个问题?