2017-01-08 1 views
0

포럼에서이 오류를보고 응답을 읽었지만 아직 무엇인지 또는 어떻게 처리하는지 이해할 수 없습니다. 16k 링크에서 인터넷에서 데이터를 긁어 내 스크립트는 각 링크에서 비슷한 정보를 긁어내어 .csv에 씁니다. 일부 오류는이 오류 이전에 기록됩니다.Python http.client.Incomplete 읽기 (0 바이트 읽기) 오류

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. 그의 해결책은 효과가있다. –