PIL Issue, OSError: cannot open resource PIL Issue, OSError: cannot open resource python-3.x python-3.x

PIL Issue, OSError: cannot open resource


I fixed the problem by using default font.

font = ImageFont.load_default()

If you just need to put some text (font style is not matter to you) then this might be a simple solution.

font = ImageFont.load_default()draw = ImageDraw.Draw(pil_img)draw.text(( 20, 32), "text_string", (255,0,0), font=font)


from PIL import Image, ImageDraw, ImageFontim = Image.open("mak.png")font_type = ImageFont.truetype("arial.ttf", 18)draw = ImageDraw.Draw(im)draw.text(xy=(120, 120), text= "download font you want to use", fill=(255,69,0), font=font_type)im.show()

Its "arial.ttf" not "Arial.ttf"

Here is the link to download arial.ttf font.


I have also met this issue on Windows 10 Pro with PIL 5.3.0.

On my machine, the error is caused by non-ASCII font file names. If I change the the font name to only contain ASCII characters, I can open the font without any error.

Edit (2019-07-29): this is indeed a bug with ImageFont.truetype() method and it has been fixed in this pull request.