xtream1101 / it-ebooks-dl

Depreciated, use project scrape-itebooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to deal with IncompleteRead problem?

li-xinyang-me opened this issue · comments

Exception in thread Thread-34:0:36:47
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "it-ebooks-dl.py", line 150, in _dl_start
    self._dl_worker(self._saved_list[num])
  File "it-ebooks-dl.py", line 188, in _dl_worker
    data = response.read()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 512, in read
    s = self._safe_read(self.length)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 664, in _safe_read
    raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(79077 bytes read, 27929599 more expected)
Exception in thread Thread-31:d Time: 2:37:13
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 868, in run
    self._target(*self._args, **self._kwargs)
  File "it-ebooks-dl.py", line 150, in _dl_start
    self._dl_worker(self._saved_list[num])
  File "it-ebooks-dl.py", line 188, in _dl_worker
    data = response.read()
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 512, in read
    s = self._safe_read(self.length)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 664, in _safe_read
    raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(19357756 bytes read, 5579686 more expected)

Normally the program continue downloading when encourter this problem but sometime it does not continue and has to start over again from book number 1.

Using single thread for downloading seems solve the issue, unstable internet connection might be the source of issue. Finally get the work done, thank you.