-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Cannot pickle ImageFont objects #5825
Copy link
Copy link
Closed
Labels
Description
What did you do?
I'm trying to pickle TrueType ImageFont font:
from PIL import ImageFont
import pickle
font = ImageFont.truetype('2Dumb.ttf', size=30)
pickled = pickle.dumps(font, protocol=pickle.HIGHEST_PROTOCOL)What did you expect to happen?
Font object should be correctly pickled.
What actually happened?
The following error was thrown:
Traceback (most recent call last):
File "C:\Users\alis\.virtualenvs\ocr-BMJCq2bR\lib\site-packages\IPython\core\interactiveshell.py", line 3444, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-f334d76ecd99>", line 1, in <module>
pickled = pickle.dumps(font, protocol=pickle.HIGHEST_PROTOCOL)
TypeError: cannot pickle 'Font' object
What are your OS, Python and Pillow versions?
- OS: Windows 10
- Python: 3.9.6
- Pillow: 8.4.0
- Font: 2Dumb.zip
Reactions are currently unavailable