KindleUnpack icon indicating copy to clipboard operation
KindleUnpack copied to clipboard

imghdr used in cover will be removed in python 3.13

Open clach04 opened this issue 2 years ago • 4 comments
trafficstars

https://github.com/kevinhendricks/KindleUnpack/blob/master/lib/mobi_cover.py#L11

From https://docs.python.org/3/library/imghdr.html

Deprecated since version 3.11, will be removed in version 3.13: The imghdr module is deprecated (see PEP 594 for details and alternatives).

clach04 avatar Jan 14 '23 16:01 clach04

None of the suggested replacements in the PEP support python 2. Could adopt imghdr into projector add additional checks to existing code for types we care about.

I do have a project https://github.com/clach04/magic-fork which might be suitable .

clach04 avatar Jan 14 '23 17:01 clach04

We will keep it in mind but we still have plenty of time since it was just deprecated in 3.11.

filetype might be an option.

We may decide to remove python2 support since all work on kfx input seems to be python3 only.

kevinhendricks avatar Jan 14 '23 19:01 kevinhendricks

Also, since the current python lib imghdr.py is a simple self-contained module we may just decide to include a version of it as part of kindleunpack.

kevinhendricks avatar Jan 14 '23 19:01 kevinhendricks

Another alternative is PureMagic, imghdr support was recently built into it. You should be able to use it as a drop-in replacement without modification.

NebularNerd avatar Aug 15 '24 18:08 NebularNerd