Add exception handling

main
Bob Mottram 2024-07-18 11:01:12 +01:00
parent ccd06e614f
commit e60c8d65dc
1 changed files with 9 additions and 2 deletions

View File

@ -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" +