Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError when downloading PDF volumes #78

Closed
Ethaisa123 opened this issue Jun 26, 2023 · 2 comments · Fixed by #79
Closed

FileNotFoundError when downloading PDF volumes #78

Ethaisa123 opened this issue Jun 26, 2023 · 2 comments · Fixed by #79
Labels
bug Something isn't working

Comments

@Ethaisa123
Copy link

Ethaisa123 commented Jun 26, 2023

What happened ?

After downloading the chapters when the worker converts the volume into a PDF I get a FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Ethan\Downloads\Kobo-pine\New Normal\Vol. 3\000.png

Full error below:

[ERROR] We have problem in queue worker
Traceback (most recent call last):
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\utils.py", line 217, in run
    job()
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 454, in <lambda>
    self.worker.submit(lambda: self.convert(self.images, file_path))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 392, in convert
    im = im_ref()
         ^^^^^^^^
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 68, in __call__
    return self._func(*self._args, **self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\PIL\Image.py", line 3236, in open
    fp = builtins.open(filename, "rb")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Ethan\\Downloads\\Kobo-pine\\New Normal\\Vol. 3\\000.png'
[ERROR] Unhandled exception, FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Ethan\\Downloads\\Kobo-pine\\New Normal\\Vol. 3\\000.png'
Traceback (most recent call last):
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\cli\__init__.py", line 76, in _main
    download(args)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\cli\download.py", line 33, in download
    url(args, args.type)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\cli\url.py", line 166, in __call__
    self.func(self.id, args)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\cli\url.py", line 97, in download_manga
    dl_manga(*args)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\main.py", line 167, in download
    download_manga(manga, base_path)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\main.py", line 137, in download_manga
    fmt.main()
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\base.py", line 697, in main
    self.download_volumes(volumes)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\base.py", line 625, in download_volumes     
    self.on_finish(file_path, volume, images)
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 454, in on_finish
    self.worker.submit(lambda: self.convert(self.images, file_path))
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\utils.py", line 196, in submit
    raise err
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\utils.py", line 217, in run
    job()
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 454, in <lambda>
    self.worker.submit(lambda: self.convert(self.images, file_path))
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 392, in convert
    im = im_ref()
         ^^^^^^^^
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\mangadex_downloader\format\pdf.py", line 68, in __call__
    return self._func(*self._args, **self._kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Ethan\AppData\Local\Programs\Python\Python311\Lib\site-packages\PIL\Image.py", line 3236, in open
    fp = builtins.open(filename, "rb")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Ethan\\Downloads\\Kobo-pine\\New Normal\\Vol. 3\\000.png'

What did you expect to happen ?

I expected the program to convert the Folders into a PDF, in the same way as the cbz method

OS version

Windows 10

App version

mangadex-downloader v2.10.1 (https://github.com/mansuf/mangadex-downloader)
Python: 3.11.2
arch: x64
bundled executable: no

Installation origin

PyPI (Python Package Index)

Installation origin (other sources)

No response

Reproducible command

mangadex-dl https://mangadex.org/title/e1d0056a-fdd3-4f32-af19-50eeb37280ac --save-as "pdf-volume" --use-volume-cover -uvc --progress-bar-layout=none

Additional context

if you repeatedly do the same command over and over every time it crashes it will eventually get through all the chapters (using the download.db I'm guessing)

@mansuf
Copy link
Owner

mansuf commented Jun 26, 2023

Man, seems like i messed up when refactoring codes. Sorry about that, i've made PR #79 to fix this issue. You can test it by installing patched version.

Please note that you need git to install patched version

# Make sure you uninstall previous version mangadex-downloader
pip uninstall mangadex-downloader

# Install patched version
pip install -U git+https://github.com/mansuf/mangadex-downloader.git@e4b4e456ca9188d305c1af443a4c947bae570646

The issue was caused by images that want to be converted but the images already been deleted. If you're curious what code has causing this.

Technically PDFVolume.images has been used to store downloaded images for each volumes and after that the application will convert to pdf and delete the images. The problem is PDFVolume.images values never been cleared after previous volumes has been converted, so it will trying to convert images to pdf from previous volumes.

@Ethaisa123
Copy link
Author

oh nice works perfectly now, thanks man.

mansuf added a commit that referenced this issue Jun 27, 2023
Fix formats `pdf-volume` and `cb7-volume` are not working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants