mansuf / mangadex-downloader

A command-line tool to download manga from MangaDex, written in Python.
https://mangadex-dl.mansuf.link/
MIT License
477 stars 39 forks source link

Random NoneType error while downloading #18

Closed shinji257 closed 2 years ago

shinji257 commented 2 years ago

Version 1.0.0 (I just installed it today) Install via Python PIP OS: Linux Mint 20.3 Python Version: 3.8.10 Command: mangadex-dl --login-username (redacted) --login-password (redacted) --save-as tachiyomi --cover original --unsafe https://mangadex.org/title/c1d990dd-9ff2-4e47-b93d-5e56e34c5069/digimon-xros-wars

I know tachiyomi is supposed to be default but I was seeing it using raw format so I enforced it.

I'm not sure what is triggering this. If I restart the download it will go down and skip the files it grabbed then pickup just fine where it left off.

[ERROR] Unhandled exception, AttributeError: 'NoneType' object has no attribute 'startswith'
Traceback (most recent call last):
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/cli/__init__.py", line 35, in _main
    download(args)
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/cli/download.py", line 12, in download
    url(args, args.type)
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/cli/url.py", line 144, in __call__
    self.func(self.id, args)
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/cli/url.py", line 66, in download_manga
    dl_manga(*args)
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/main.py", line 331, in download
    fmt.main()
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/format/tachiyomi.py", line 61, in main
    success = downloader.download()
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/downloader.py", line 172, in download
    self._report(resp, length, round((t2 - t1) * 1000), False)
  File "/home/shinji/.local/lib/python3.8/site-packages/mangadex_downloader/downloader.py", line 254, in _report
    if resp.headers.get('x-cache').startswith('HIT'):
AttributeError: 'NoneType' object has no attribute 'startswith'
rokibhasansagar commented 2 years ago

I too got same type of error today.

I appended --use-chapter-title --enable-legacy-sorting --unsafe options to the CLI for various format downloads (pdf, cbz, tachiyomi-zip)

But after passing some time, I restarted download again with same command options, and then worked correctly.

mansuf commented 2 years ago

I'm not sure what is triggering this. If I restart the download it will go down and skip the files it grabbed then pickup just fine where it left off.

Server error, which caused downloader report system to failing. i have should expect that Response headers are not parsed properly when this happen.

Whenever you logged in and downloading a manga, mangadex-downloader automatically reports to MangaDex network for each images that have you downloaded (read more here). I suggest you to not login until this issue is fixed

shinji257 commented 2 years ago

Ok. I stopped logging in and I still got the error randomly. Usually I can go ahead and restart the download and be fine.

mansuf commented 2 years ago

Can you give me the full logs ? i want to see what happened. I can't get the errors when i try it

shinji257 commented 2 years ago

I don't have any logs to give at the moment (it just shows the files it is downloading then suddenly error) but I'll enable verbose mode and have it start piping to a file for the next time it hits.

mansuf commented 2 years ago

I have created pull request regarding this issue, it should be fixed. You can test it by install from repository bug/18. Let me know if this issue still happens. I will merge the pull request to main repository once this issue is fixed

shinji257 commented 2 years ago

Here you go. https://termbin.com/d5zp

Commandline in use: mangadex-dl --save-as tachiyomi --cover original --unsafe --verbose https://mangadex.org/title/e8f5317a-fba5-4d8d-ae3c-00b9ee6c1a44/tsf-monogatari

shinji257 commented 2 years ago

I have created pull request regarding this issue, it should be fixed. You can test it by install from repository bug/18. Let me know if this issue still happens. I will merge the pull request to main repository once this issue is fixed

Ok. Previous reply was before I saw your PR so I'm going to test it some more and see if I hit it with the fix.

shinji257 commented 2 years ago

Really confident that the issue is cleared with the PR. I have been downloading near non-stop and have been unable to reproduce it. Now that I'm posting this I'm sure I'll come back in a few minutes and report that it is still there but if I don't...

mansuf commented 2 years ago

Well, it's now more than a hours since your last reply. I will merge the PR and mark this issue as fixed.

mansuf commented 2 years ago

This fix is released in v1.0.1. You can re-install the latest stable version 👍