Skip to content

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Aug 6, 2022

Resolves #6324

It has been requested we document that on Windows, FreeType keeps the font file open while Pillow is using it.

Testing this,

import shutil
shutil.copy("Tests/fonts/FreeMono.ttf", "out.ttf")
font = ImageFont.truetype("out.ttf")
os.remove("out.ttf")

on Windows, I see a PermissionError. On macOS and Linux, there is no problem.

The error disappears on CPython if you insert del font before os.remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PermissionError when attempting to use importlib.resources on Windows to load a custom font with ImageFont

2 participants