2017-01-08 32 views
0

私はフォーラムでこのエラーを見て、まだ回答を読んでいますが、それが何であるか、それを解決する方法がまだ分かりません。私は16kのリンクからインターネットからデータを拝借しています。私のスクリプトは各リンクから同様の情報を奪って、.csvに書き込みます。このエラーの前に書かれた日付があります。Python http.client.Incomplete Read(0 bytes read)error

Traceback (most recent call last): 
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 541, in _get_chunk_left 
    chunk_left = self._read_next_chunk_size() 
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 508, in _read_next_chunk_size 
    return int(line, 16) 
ValueError: invalid literal for int() with base 16: b'' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 558, in _readall_chunked 
    chunk_left = self._get_chunk_left() 
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 543, in _get_chunk_left 
    raise IncompleteRead(b'') 
http.client.IncompleteRead: IncompleteRead(0 bytes read) 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
File "MoviesToDb.py", line 91, in <module> 
html = r.read() 
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 455, in read 
    return self._readall_chunked() 
File "/usr/local/Cellar/python3/3.5.2_3/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 565, in _readall_chunked 
    raise IncompleteRead(b''.join(value)) 
http.client.IncompleteRead: IncompleteRead(17891 bytes read) 

私は知りたいと思います:
1)このエラーは何を意味しますか?
2)どうしたらいいですか?輸入へ

答えて

-1

試してみてください。

from http.client import IncompleteRead 

とスクリプトでこれを追加します。

except IncompleteRead: 
    # Oh well, reconnect and keep trucking 
     continue 
+0

彼は値しません-2。彼の解決策はうまくいく。 –