|
发表于 2017-9-13 19:32:01
|
显示全部楼层
RESTART: C:/Users/Administrator/AppData/Local/Programs/Python/Python35-32/鱼c学习代码/百度图片爬虫.py
当前图片:0
[WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
服务器长时间无响应,自动切换代理.....
Traceback (most recent call last):
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python35-32/鱼c学习代码/百度图片爬虫.py", line 36, in get_result
return urllib.request.urlretrieve(req_or_url,filename)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 188, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 466, in open
response = self._open(req, data)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 484, in _open
'_open', req)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 444, in _call_chain
result = func(*args)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\urllib\request.py", line 1282, 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 1257, in do_open
r = h.getresponse()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 1198, in getresponse
response.begin()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\socket.py", line 576, in readinto
return self._sock.recv_into(b)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\random.py", line 262, in choice
i = self._randbelow(len(seq))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\random.py", line 239, in _randbelow
r = getrandbits(k) # 0 <= r < 2**k
ValueError: number of bits must be greater than zero
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python35-32/鱼c学习代码/百度图片爬虫.py", line 121, in <module>
download() #开始下载
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python35-32/鱼c学习代码/百度图片爬虫.py", line 114, in download
get_result(pic_url,True,save_path+'\\'+file_name)
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python35-32/鱼c学习代码/百度图片爬虫.py", line 55, in get_result
change_proxy()
File "C:/Users/Administrator/AppData/Local/Programs/Python/Python35-32/鱼c学习代码/百度图片爬虫.py", line 78, in change_proxy
proxy = random.choice(proxies)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\random.py", line 264, in choice
raise IndexError('Cannot choose from an empty sequence')
IndexError: Cannot choose from an empty sequence |
|