为了账号安全,请及时绑定邮箱和手机立即绑定

Python:URLError:<urlopen错误[Errno 10060]

Python:URLError:<urlopen错误[Errno 10060]

蓝山帝景 2019-11-20 09:46:10
操作系统:Windows 7; 使用Python GUI Shell的Python 2.7.3我正在尝试通过Python阅读网站,并且有多个作者使用urllib和urllib2库。要将网站存储在变量中,我看到了类似的方法:import urllibimport urllib2g = "http://www.google.com/"read = urllib2.urlopen(g)最后一行在120+秒后生成错误:> Traceback (most recent call last):   File "<pyshell#27>", line 1, in> <module>>     r = urllib2.urlopen(o)   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>我尝试绕过该g变量,并尝试urlopen("http://www.google.com/")都不成功(在相同的时间长度后会生成相同的错误)。
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 2017 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信