Ask coding questions

← Back to all posts
OSError: cannot open resource
CreamySouce (0)

Hi all!
I'm getting this error trace in m console whenever someone joins my server.

Ignoring exception in on_member_join
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/runner/Raid-Protect-Discord-Bot/Cogs/onJoin.py", line 70, in on_member_join
font = ImageFont.truetype(font= "arial", size= 60)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/PIL/ImageFont.py", line 852, in truetype
return freetype(font)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/PIL/ImageFont.py", line 849, in freetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/PIL/ImageFont.py", line 209, in init
self.font = core.getfont(
OSError: cannot open resource

Comments
hotnewtop
Coder100 (17011)

it's really dumb how they don't have a single font in repl.

What you have to do is:

  • install a font (fontsquirrel, google fonts, etc.)
  • upload it to replit
  • register the font
  • use the font
CreamySouce (0)

Alright well i asked the original creator on git and he fixed this issue in the next update! Thanks yall for the fast response and good ideas!!

Coder100 (17011)

you don't have that font, you are going to have to install it somehow.