zachMelody / bilibili-live-recorder

下载 bilibili 直播 视频流
MIT License
77 stars 12 forks source link

requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(373 bytes read #2

Closed kaidiren closed 5 years ago

kaidiren commented 5 years ago
Process Process-1:
Traceback (most recent call last):
  File "/root/B/bili/lib/python3.6/site-packages/urllib3/response.py", line 360, in _error_catcher
    yield
  File "/root/B/bili/lib/python3.6/site-packages/urllib3/response.py", line 669, in read_chunked
    chunk = self._handle_chunk(amt)
  File "/root/B/bili/lib/python3.6/site-packages/urllib3/response.py", line 615, in _handle_chunk
    value = self._fp._safe_read(amt)
  File "/usr/local/python/lib/python3.6/http/client.py", line 614, in _safe_read
    raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(373 bytes read, 139 more expected)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/root/B/bili/lib/python3.6/site-packages/requests/models.py", line 750, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/root/B/bili/lib/python3.6/site-packages/urllib3/response.py", line 490, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/root/B/bili/lib/python3.6/site-packages/urllib3/response.py", line 694, in read_chunked
    self._original_response.close()
  File "/usr/local/python/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/root/B/bili/lib/python3.6/site-packages/urllib3/response.py", line 378, in _error_catcher
    raise ProtocolError('Connection broken: %r' % e, e)
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(373 bytes read, 139 more expected)', IncompleteRead(373 bytes read, 139 more expected))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/python/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/local/python/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "run.py", line 53, in run
    self.record(urls[0], c_filename)
  File "run.py", line 36, in record
    for chunk in resp.iter_content(chunk_size=512):
  File "/root/B/bili/lib/python3.6/site-packages/requests/models.py", line 753, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(373 bytes read, 139 more expected)', IncompleteRead(373 bytes read, 139 more expected))

大佬有什么思路么? 纯粹是因为网络问题么?

zachMelody commented 5 years ago

可以尝试一下这个办法,链接