Using Django, and easy_thumbnails coupled with Pillow specifically I’m stumbled upon this error in PIL.ImageFile on PIL/_binary.py:
ord() expected a character, but string of length 0 found
This python error was so frequent I’ve done some research, coming up with nothing.
I’ve checked current Pillow version with:
pip freeze | grep Pillow
Getting:
Pillow==3.0.0
Then I’ve upgraded the Pillow package with this:
pip install Pillow --upgrade
The sofware was updated to the very last version (5.0.0) without any issue on easy_thumbnails backend or frontend.
Consequently, pip freeze returned:
Pillow==5.0.0
and errors are gone.
tl;dr: Update Pillow from 3.0.0 to latest version (5.0.0 by now)
Note: this error can be accompained by others:
- unpack requires a string argument of length 2
- string index out of range
Upgrading Pillow also correct these.