pallets-eco / flask-admin

Simple and extensible administrative interface framework for Flask
https://flask-admin.readthedocs.io
BSD 3-Clause "New" or "Revised" License
5.69k stars 1.56k forks source link

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #2375

Open pankus opened 10 months ago

pankus commented 10 months ago

https://github.com/flask-admin/flask-admin/blob/896fca64f7eb7970bb5775c2c9ff6b3a07c9de4a/flask_admin/form/upload.py#L467C21-L467C21

ANTIALIAS was removed in Pillow 10.0.0 (after being deprecated through many previous versions). Now you need to use PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS. https://stackoverflow.com/a/76616129/5541592

Line 467 must be corrected. Even better, I presume, if a user can manage the compression type using some user-defined parameter.

skwzrd commented 8 months ago

Seems like this was fixed on the master branch (currently version 1.6.1), https://github.com/flask-admin/flask-admin/blob/14e24c970f0ee3a29add830612eee9a0b0ba5dcc/flask_admin/form/upload.py#L464

And here is the commit https://github.com/flask-admin/flask-admin/commit/96b92deef8b087e86a9dc3e84381d254ea5c0342

I tested uploading a file, and didn't receive any errors.

urshulgi commented 1 month ago

Seems like this was fixed on the master branch (currently version 1.6.1),

Maybe I'm wrong but I can see the commit and this is from August 9, 2023: image

And the version was released June 19: image

So the fix was added two months later?

And another thing, I can see 1.6.1 being on a different date on pypi, February 20 (Which matches the tag build): image

I just downloaded the source code that is attached to the release here on GH for 1.6.1 and still can see ANTIALIAS: image

And I have got the error despite reinstalling the library a few times: image