From e60c8d65dc52c262428800b3a4e2bdfc7402976e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 18 Jul 2024 11:01:12 +0100 Subject: [PATCH] Add exception handling --- theme.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/theme.py b/theme.py index 805ed6460..31d156832 100644 --- a/theme.py +++ b/theme.py @@ -518,8 +518,15 @@ def _set_dyslexic_font(base_dir: str) -> bool: template_filename = base_dir + '/' + filename if not os.path.isfile(template_filename): continue - with open(template_filename, 'r', encoding='utf-8') as fp_css: - css = fp_css.read() + + css = None + try: + with open(template_filename, 'r', encoding='utf-8') as fp_css: + css = fp_css.read() + except OSError: + print('EX: _set_dyslexic_font unable to read ' + template_filename) + + if css: css = \ set_css_param(css, "*src", "url('./fonts/OpenDyslexic-Regular.woff2" +