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

Error with Python3.10 #440

Closed
paubanon opened this issue Oct 12, 2022 · 13 comments
Closed

Error with Python3.10 #440

paubanon opened this issue Oct 12, 2022 · 13 comments

Comments

@paubanon
Copy link

I'm trying to convert a manga to read it with my Kindle Oasis but it keeps popping the same error. I've tried converting to cbz, change images format, pdf, ... And always get the same error, so I guess there must be something with the images (although I can see them perfectly on the computer.

One of workers crashed. Cause: 'float' object cannot be interpreted as an integer
Traceback:
File "/app/lib/python3.10/site-packages/kindlecomicconverter/comic2ebook.py", line 563, in imgFileProcessing
img.autocontrastImage()
File "/app/lib/python3.10/site-packages/kindlecomicconverter/image.py", line 258, in autocontrastImage
self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: 255 * (a / 255.) ** gamma))
File "/app/lib/python3.10/site-packages/PIL/Image.py", line 3085, in eval
return image.point(args[0])
File "/app/lib/python3.10/site-packages/PIL/Image.py", line 1651, in point
return self._new(self.im.point(lut, mode))

@it0na72
Copy link

it0na72 commented Oct 12, 2022

im getting the exact same error. tried using different files as well with no success. i'm using pop os 22.04. not sure if the most recent update caused this.

@lucasangi
Copy link

I'm getting the exact same error on Fedora 36 with pillow 9.2.0.

@darodi
Copy link
Collaborator

darodi commented Oct 12, 2022

Pillow >= 8.4.0

Duplicate of #406

@hiagofranco
Copy link

hiagofranco commented Oct 13, 2022

I was getting the same error, even with Pillow and Slugify installed:

$ pip3 freeze | grep -i -E "(pillow|slugify)"
Pillow==9.2.0
python-slugify==2.0.1

However I was using the Flatpak version. Now, I cloned the repo and ran it on terminal, everything works as expected.

$ python3 kcc.py

I'm using Linux Mint 21. Hope this helps.

@hhtien1408
Copy link

I was getting the same error, even with Pillow and Slugify installed:

$ pip3 freeze | grep -i -E "(pillow|slugify)"
Pillow==9.2.0
python-slugify==2.0.1

However I was using the Flatpak version. Now, I cloned the repo and ran it on terminal, everything works as expected.

$ python3 kcc.py

I'm using Linux Mint 21. Hope this helps.

I'm also using KCC 5.5.2-6 Flatpak version but still got error with python-3.10. I read your solution but unable to know how to use.
Hope you could explain more in detail. I really would like to make KCC work in Linux Mint 20.3.
Thanks a lot!
Screenshot from 2022-10-17 10-09-26

@hiagofranco
Copy link

Hi @hhtien1408,

Sure, here are the steps that I've done:

  1. First, I removed the flatpack version from my computer.
  2. Next, I downloaded this repo by running
$ git clone https://github.com/ciromattia/kcc.git
  1. Then I installed the necessary packages. You can do it by running the following command. The requirements.txt file is inside this repository, you will see it when you clone the repo.
$ pip3 install -r requirements.txt
  1. This should install the packages mentioned in Work-around to "RuntimeError... 'float' object cannot be interpreted as an integer during execution" for kcc-c2e.py powershell/CLI #406. You can check the version by running
$ pip3 freeze

If the packages are in the wrong version, you can try to upgrade them by running

$ pip3 install --upgrade name_of_the_package
  1. Now, it should be all done. You can go to the folder of this repo and run
$ python3 kcc.py

If everything goes well, you now should be able to use it. However, if you are still seeing the same error, you can try to change the code mentioned in #406. Go to line 258 of kcc/kindlecomicconverter/image.py file and change it with the following line:

self.image = ImageOps.autocontrast(Image.eval(self.image, lambda a: int(255 * (a / 255.) ** gamma)))

I didn't have to do this modification, just installed the right packages was enough. But maybe you could try it aswell. Hope this helps!

@hiagofranco
Copy link

Hi @hhtien1408,

Unfortunately, I can't help you with that, I didn't test it on Windows or macOS, only Linux. I think it's possible to use an Ubuntu docker image and install kcc inside of it, but I won't be able to help you with that.

@hiagofranco
Copy link

hiagofranco commented Oct 17, 2022

Hi @hhtien1408,

I didn't try to fix the package myself, instead, I cloned this repo and run it manually. I'm not sure if it's possible to fix the packager or not.

@hhtien1408
Copy link

hhtien1408 commented Oct 17, 2022

Screenshot from 2022-10-17 21-56-27
@hiagofranco I managed to make it working under Linux Mint 20.3 with your guide and some extra steps by myself to make life easier.

If you would like to try KCC v5.5.3-beta-darodi.6
$ wget https://github.com/darodi/kcc/archive/refs/tags/v5.5.3-beta-darodi.6.zip
$ unzip v5.5.3-beta-darodi.6.zip
Rename folder 'kcc-5.5.3-beta-darodi.6' into 'kcc' for convenience.

Download and copy kindlegen into '/usr/local/bin' and grant execute permissions for MOBI conversion.
$ wget https://archive.org/download/kindlegen_linux_2_6_i386_v2_9/kindlegen_linux_2.6_i386_v2_9.tar.gz
$ unzip kindlegen_linux_2.6_i386_v2_9.tar.gz
$ sudo cp -R '/home/h2t/Desktop/kindlegen' '/usr/local/bin'
$ sudo chmod +rwx '/usr/local/bin/kindlegen'

Create destop file in '/home/h2t/.local/share/applications' with codes:

#!/usr/bin/env xdg-open

[Desktop Entry]
Type=Application
Name=Kindle Comic Converter
Icon=kcc
Exec=python3 '/home/h2t/kcc/kcc.py'
Terminal=false
StartupWMClass=kcc
Name[en_US]=Kindle Comic Converter

Copy icon file into '/home/h2t/.local/share/icons'

$ sudo cp -R '/home/h2t/Desktop/kcc.png' '/home/h2t/.local/share/icons'

It worked flawlessly with KEPUB conversion for my Kobo Aura One and MOBI for KPW3 from CBZ (with full metadata and TOC using ComicInfo.xml method).

Your help is highly appreciated!

@hiagofranco
Copy link

Hi @hhtien1408,

Thanks for your suggestions! I'll definitely try them later. Thanks!

Your help is highly appreciated!

Happy to help!

@hhtien1408
Copy link

hhtien1408 commented Oct 17, 2022 via email

@paubanon
Copy link
Author

@hiagofranco @hhtien1408 Thank you very much! It works perfectly now :D

@catsout
Copy link
Contributor

catsout commented Jan 9, 2023

I can't reproduce on the flatpak version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants