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

DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13 #631

Closed
anderspetersson opened this issue Mar 23, 2024 · 3 comments · Fixed by #650
Closed

Comments

@anderspetersson
Copy link

easy-thumbnails==2.8.5
python3.11

easy_thumbnails/optimize/post_processor.py:3:

DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
from imghdr import what as determinetype

Here is how https://github.com/streamlit/streamlit migrated from imghdr to using Pillow functionality: streamlit/streamlit@3d5dd61

@benkonrath
Copy link
Contributor

The file is already open in the streamit example which is why they just use PIL. For easy-thumbnails, I think we'll need to use one of the suggested replacements found in the deprecation table, or 'vendor' the imghdr module into the code base (licenses have to allow this of course).

https://peps.python.org/pep-0594/#deprecated-modules

If we use one of the suggested libraries, care needs to be taken to ensure it produces the same result. e.g. 'jpeg' for Jpegs and not 'jpg', 'JPEG', 'JPG', etc.

@anderspetersson
Copy link
Author

Python 3.13 is out and this issue are preventing me from upgrading. Is it time to migrate to another package or can we get a decision how to move forward with fixing this issue?

@benkonrath
Copy link
Contributor

It turns out PIL can be used here (see PR). That made the update easier.

@jrief jrief closed this as completed in #650 Nov 9, 2024
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

Successfully merging a pull request may close this issue.

2 participants