OSError: Cannot open resource when trying to use Imagefont on unicorn hat mini

Hi there
I am having issues when trying to execute code which contains the following line:
from PIL import Image, ImageDraw, ImageFont

The error message I recieve is:
Traceback (most recent call last):
File "/home/pi/Desktop/hello_world.py", line 15, in <module>
font = ImageFont.truetype("arial.ttf",12)
File "/usr/lib/python3/dist-``packages/PIL/ImageFont.py", line 280, in truetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/usr/lib/python3/dist- packages/PIL/ImageFont.py", line 145, in __init__
layout_engine=layout_engine)
OSError: cannot open resource

I’m really not sure about how to fix this, any suggestions/help is greatly appreciated

Looks to me like it can’t find the arial.ttf font.

Google tells me that you can list all installed fonts by running fc-list in a terminal. Try that, see if Arial is installed (I don’t think it is by default?), and maybe change font = ImageFont.truetype("arial.ttf",12) to use one of the installed fonts.

EDIT: Yup, I’ve just checked on my Pi4 and arial is not installed on Raspbian by default and this is indeed what happens when you try to use a font which isn’t installed. Try using something like Piboto-Regulat.ttf.