Skip to content

[Error] OSError: cannot open resource #1

@seupedro

Description

@seupedro

Python 3.12
Mac OS 14.3

Traceback (most recent call last):
  File "/Users/seupedro/projects/typewriter-python/typewriter_effect.py", line 193, in <module>
    create_video_with_typewriter_effect(text, output_filename, fontsize=settings.get('fontsize', 30), video_fps=settings.get('video_fps', 30), video_duration=settings.get('video_duration', 10))
  File "/Users/seupedro/projects/typewriter-python/typewriter_effect.py", line 148, in create_video_with_typewriter_effect
    font = ImageFont.truetype(font_filename, fontsize)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/seupedro/projects/typewriter-python/.venv/lib/python3.12/site-packages/PIL/ImageFont.py", line 819, in truetype
    return freetype(font)
           ^^^^^^^^^^^^^^
  File "/Users/seupedro/projects/typewriter-python/.venv/lib/python3.12/site-packages/PIL/ImageFont.py", line 816, in freetype
    return FreeTypeFont(font, size, index, encoding, layout_engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/seupedro/projects/typewriter-python/.venv/lib/python3.12/site-packages/PIL/ImageFont.py", line 245, in __init__
    self.font = core.getfont(
                ^^^^^^^^^^^^^
OSError: cannot open resource

Can you provide a docker image?
Because libraries like opencv, imagemagick are pretty trick to get it working on different environments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions