From 7348015d4512ca6f2269e19dde80b112517b4e6d Mon Sep 17 00:00:00 2001 From: Hadeed Ahmad Date: Sun, 1 Oct 2023 11:22:49 +0500 Subject: [PATCH] Add error handling to python script --- bin/write_symbol_map.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/write_symbol_map.py b/bin/write_symbol_map.py index eec57b5..b553582 100755 --- a/bin/write_symbol_map.py +++ b/bin/write_symbol_map.py @@ -1,12 +1,17 @@ #! /usr/bin/env python3 import os +import shutil import subprocess import sys font_file = "/usr/share/fonts/TTF/SymbolsNerdFontMono-Regular.ttf" if not os.path.exists(font_file): - sys.stderr.write(f"Error: The font file does not exist.\n") + sys.stderr.write("Error: The font file does not exist.\n") + sys.exit(1) + +if shutil.which("otfinfo") is None: + sys.stderr.write("Error: otfinfo not found.\n") sys.exit(1) def create_maps(numbers):