ciromattia / kcc

KCC (a.k.a. Kindle Comic Converter) is a comic and manga converter for ebook readers.
ISC License
2.6k stars 208 forks source link

flatpak Error during processing MOBI #736

Closed mrtn619 closed 6 days ago

mrtn619 commented 2 weeks ago

I'm on linux, I've installed KCC through flathub, put kindlegen_linux_i386 to ~/.var/app/io.github.ciromattia.kcc/data/kindlegen and granted the host permision using flatseal but for some reason it does not work. I've tried using pdf, images, but nothing seems to work I've launched KCC from terminal and this is the error log I've recieved:

flatpak run io.github.ciromattia.kcc
qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
Preparing source images...
Checking images...
Processing images...
Creating EPUB file...
Traceback (most recent call last):
  File "/usr/lib/python3.11/shutil.py", line 853, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] File or directory does not exist: '/home/marti/Scaricati/One Piece [Volume 3] (pdf.io).mobi' -> '/home/marti/Scaricati/One Piece [Volume 3] (pdf.io).mobi_toclean'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/lib/python3.11/site-packages/kindlecomicconverter/KCC_gui.py", line 369, in run
    self.workerOutput.append(comic2ebook.makeMOBIFix(
                             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/lib/python3.11/site-packages/kindlecomicconverter/comic2ebook.py", line 1256, in makeMOBIFix
    move(mobiPath, mobiPath + '_toclean')
  File "/usr/lib/python3.11/shutil.py", line 873, in move
    copy_function(src, real_dst)
  File "/usr/lib/python3.11/shutil.py", line 448, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.11/shutil.py", line 256, in copyfile
    with open(src, 'rb') as fsrc:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] File or directory does not exist: '/home/marti/Scaricati/One Piece [Volume 3] (pdf.io).mobi'

Schermata del 2024-08-31 13-56-21

axu2 commented 2 weeks ago

@mrtn619 does removing the period in the file name fix it? Aka 'pdf.io'

Lokiavanger commented 1 week ago

I'm having the same issue listed here. It generates all the EPUBs and then the first EPUB disappears and the app hangs. I'm on Ubuntu 24.04 running the Flatpak version. I have subfolders of images that are being converted.

Let me know if there is more information I can provide. Thank you!

`flatpak run io.github.ciromattia.kcc Gtk-Message: 10:48:35.472: Failed to load module "xapp-gtk3-module" Qt: Session management error: Could not open network socket qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile Preparing source images... Checking images... Processing images... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Traceback (most recent call last): File "/usr/lib/python3.11/shutil.py", line 853, in move os.rename(src, real_dst) FileNotFoundError: [Errno 2] No such file or directory: '/home/loki/Documents/Mangas/Battle Royale 1.mobi' -> '/home/loki/Documents/Mangas/Battle Royale 1.mobi_toclean'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/lib/python3.11/site-packages/kindlecomicconverter/KCC_gui.py", line 369, in run self.workerOutput.append(comic2ebook.makeMOBIFix( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/lib/python3.11/site-packages/kindlecomicconverter/comic2ebook.py", line 1256, in makeMOBIFix move(mobiPath, mobiPath + '_toclean') File "/usr/lib/python3.11/shutil.py", line 873, in move copy_function(src, real_dst) File "/usr/lib/python3.11/shutil.py", line 448, in copy2 copyfile(src, dst, follow_symlinks=follow_symlinks) File "/usr/lib/python3.11/shutil.py", line 256, in copyfile with open(src, 'rb') as fsrc: ^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/home/loki/Documents/Mangas/Battle Royale 1.mobi' ` image

axu2 commented 1 week ago

@Lokiavanger can you try downgrading kcc to 5.6.5 and 5.6.4 to see if issue still occurs?

Lokiavanger commented 1 week ago

@axu2 I'm getting the same error on 5.6.5 which is the oldest commit I see on flathub. That is commit a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b.

Thanks again!

`flatpak run io.github.ciromattia.kcc Gtk-Message: 11:21:07.450: Failed to load module "xapp-gtk3-module" Gtk-Message: 11:21:07.478: Failed to load module "canberra-gtk-module" Gtk-Message: 11:21:07.479: Failed to load module "canberra-gtk-module" qt.qpa.qgnomeplatform: Could not find color scheme "" Qt: Session management error: Could not open network socket libpng warning: iCCP: known incorrect sRGB profile Preparing source images... Checking images... Processing images... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Creating EPUB file... Traceback (most recent call last): File "/usr/lib/python3.11/shutil.py", line 853, in move os.rename(src, real_dst) FileNotFoundError: [Errno 2] No such file or directory: '/home/loki/Documents/Mangas/Battle Royale 1.mobi' -> '/home/loki/Documents/Mangas/Battle Royale 1.mobi_toclean'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/lib/python3.11/site-packages/kindlecomicconverter/KCC_gui.py", line 366, in run self.workerOutput.append(comic2ebook.makeMOBIFix( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/lib/python3.11/site-packages/kindlecomicconverter/comic2ebook.py", line 1246, in makeMOBIFix move(mobiPath, mobiPath + '_toclean') File "/usr/lib/python3.11/shutil.py", line 873, in move copy_function(src, real_dst) File "/usr/lib/python3.11/shutil.py", line 448, in copy2 copyfile(src, dst, follow_symlinks=follow_symlinks) File "/usr/lib/python3.11/shutil.py", line 256, in copyfile with open(src, 'rb') as fsrc: ^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/home/loki/Documents/Mangas/Battle Royale 1.mobi' ` image

axu2 commented 1 week ago

@Lokiavanger @mrtn619

1) Run KCC but output to epub 2) run the following python snippet on your machine and tell me the output. Don't forget to replace kindlegen and placeholder_manga.epub with the absolute paths. This is what KCC runs to create the mobi but it seems it isn't being created for you.

import subprocess
subprocess.run(['kindlegen', '-dont_append_source', '-locale', 'en', 'placeholder_manga.epub'], stdout=PIPE, stderr=STDOUT, encoding='UTF-8')
Lokiavanger commented 1 week ago

Hopefully I did this correctly. I ran this from a python interactive session. Not sure if I should be installing qemu based on the output. Thank you.

>>> subprocess.run(['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], stdout=PIPE, stderr=STDOUT, encoding='UTF-8') CompletedProcess(args=['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], returncode=127, stdout='/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen: 2: exec: qemu-i386: not found\n')

Lokiavanger commented 1 week ago

A few updates. I have a laptop running openSUSE and I'm having the same issue there with the flatpak version. I installed qemu-user and now I'm not getting that error but I'm also not seeing a MOBI file. I checked the working directory and there's nothing and nothing in the directory with the epub. Still getting the same error in the app as well.

Thank you.

subprocess.run(['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], stdout=PIPE, stderr=STDOUT, encoding='UTF-8') CompletedProcess(args=['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], returncode=1, stdout='')

axu2 commented 1 week ago

Try: @Lokiavanger

Weird it says return code is 1,

subprocess.run(['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], capture_output=True, check=True)
Lokiavanger commented 6 days ago

This is what I get.

>>> subprocess.run(['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], capture_output=True, check=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.12/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub']' returned non-zero exit status 1.

axu2 commented 6 days ago

@Lokiavanger can you try it one more time but remove the check=true part?

And then also remove the capture output part.

Kindlegen appears to be throwing an error but not showing any error message besides the nonzero return code.

Lokiavanger commented 6 days ago

It looks like it's unable to find the kindlegen file, but I can attest that it's there.

subprocess.run(['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub']) Error while loading /kindlegen: No such file or directory CompletedProcess(args=['/var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin/kindlegen', '-dont_append_source', '-locale', 'en', '/home/loki/Documents/Mangas/Battle Royale 2.epub'], returncode=1)

Contents of that folder: /var/lib/flatpak/app/io.github.ciromattia.kcc/x86_64/stable/a3971a6ee39deb4bf56733525eaac6a63589ea621d3681ff67c8b401e636736b/files/bin$ ls 7z distro kcc-c2e kindlegen normalizer raven 7zCon.sfx kcc kcc-c2p natsort qemu-i386 slugify

Contents of kindlegen: #!/bin/sh exec qemu-i386 ${XDG_DATA_HOME}/kindlegen "$@"

Not sure how to get end lines formatted in the code blocks, sorry.

axu2 commented 6 days ago

@Lokiavanger

Does anything here help?

Lokiavanger commented 6 days ago

Yes! I'm not sure how I didnt find this by searching... I didn't realize I needed to seek out kindlegen and put it in a specific directory for this to work.

I found a copy of kindlegen_linux_2.6_i386_v2_9 and moved the kindlegen file to ~/.var/app/io.github.ciromattia.kcc/data and everything generated as expected. Thanks so much for your help!