Skip to content

Error importing customtkinter when the font files in ~/.fonts don't have write permissions #2693

@tgonzalez89

Description

@tgonzalez89

If the fonts previously copied by customtkinter don't have write permissions, then customtkinter shows the following errors while importing the module:

FontManager error: [Errno 13] Permission denied: '/home/<user>/.fonts/Roboto-Regular.ttf'
FontManager error: [Errno 13] Permission denied: '/home/<user>/.fonts/Roboto-Medium.ttf'
FontManager error: [Errno 13] Permission denied: '/home/<user>/.fonts/CustomTkinter_shapes_font.otf'
customtkinter.windows.widgets.font warning: Preferred drawing method 'font_shapes' can not be used because the font file could not be loaded.
Using 'circle_shapes' instead. The rendering quality will be bad!

If customtkinter is installed in a location and write permissions have been removed from the files at that location then when shutil.copy is run it preserves the permissions of the original files. So the font files in ~/.fonts will not have the write permissions, which will trigger this error the next time customtkinter is imported.

It could open the font file permissions after copying it, to make sure that the next time it's imported it won't try to copy over a file that doesn't have write permissions. Alternatively, it could open the destination file permissions (if it exists) before attempting to copy it.

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