1
Fork 0

Add error handling to python script

This commit is contained in:
Hadeed 2023-10-01 11:22:49 +05:00
parent 679d6e168d
commit 7348015d45

View file

@ -1,12 +1,17 @@
#! /usr/bin/env python3 #! /usr/bin/env python3
import os import os
import shutil
import subprocess import subprocess
import sys import sys
font_file = "/usr/share/fonts/TTF/SymbolsNerdFontMono-Regular.ttf" font_file = "/usr/share/fonts/TTF/SymbolsNerdFontMono-Regular.ttf"
if not os.path.exists(font_file): 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) sys.exit(1)
def create_maps(numbers): def create_maps(numbers):