Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python:websockets.exceptions.ConnectionClosed在使用html请求时出错_Python_Websocket_Python 3.6_Python Requests Html - Fatal编程技术网

Python:websockets.exceptions.ConnectionClosed在使用html请求时出错

Python:websockets.exceptions.ConnectionClosed在使用html请求时出错,python,websocket,python-3.6,python-requests-html,Python,Websocket,Python 3.6,Python Requests Html,我正在使用请求\u html库,如下所示: from requests_html import HTMLSession for url in urls: ... session = HTMLSession() r = session.get(url) r.html.render() ... 每隔一段时间我就会出现以下错误: Future exception was never retrieved future: <Future fini

我正在使用
请求\u html
库,如下所示:

from requests_html import HTMLSession  


for url in urls:
    ...
    session = HTMLSession() 
    r = session.get(url)
    r.html.render() 
    ...
每隔一段时间我就会出现以下错误:

Future exception was never retrieved
future: <Future finished exception=ConnectionClosed('WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason',)>
Traceback (most recent call last):
  File "/abc/lib/python3.6/site-packages/websockets/protocol.py", line 674, in transfer_data
    message = yield from self.read_message()
  File "/abc/lib/python3.6/site-packages/websockets/protocol.py", line 742, in read_message
    frame = yield from self.read_data_frame(max_size=self.max_size)
  File "/abc/lib/python3.6/site-packages/websockets/protocol.py", line 815, in read_data_frame
    frame = yield from self.read_frame(max_size)
  File "/abc/lib/python3.6/site-packages/websockets/protocol.py", line 884, in read_frame
    extensions=self.extensions,
  File "/abc/lib/python3.6/site-packages/websockets/framing.py", line 99, in read
    data = yield from reader(2)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/streams.py", line 666, in readexactly
    raise IncompleteReadError(incomplete, n)
asyncio.streams.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason
从未检索到未来异常 未来: 回溯(最近一次呼叫最后一次): 文件“/abc/lib/python3.6/site packages/websockets/protocol.py”,第674行,在传输数据中 消息=从self.read_message()获得的收益 read_消息中的文件“/abc/lib/python3.6/site packages/websockets/protocol.py”,第742行 帧=自读数据帧的产量(最大大小=自读最大大小) 文件“/abc/lib/python3.6/site packages/websockets/protocol.py”,第815行,在read_data_框架中 帧=自读取帧的产量(最大尺寸) 文件“/abc/lib/python3.6/site packages/websockets/protocol.py”,第884行,在read_框架中 extensions=self.extensions, 文件“/abc/lib/python3.6/site packages/websockets/framing.py”,第99行,已读 数据=来自读卡器的产量(2) 文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/streams.py”,第666行,以readquick格式显示 引发不完全读取错误(不完全,n) asyncio.streams.UncompleteReadError:总共读取了2个预期字节,读取了0个字节 上述异常是以下异常的直接原因: WebSocket.exceptions.ConnectionClosed:WebSocket连接已关闭:代码=1006(连接异常关闭[内部]),无原因 代码卡在那里,什么也不做。 有没有办法让代码继续并处理for循环中的下一个url