Add error handling to python script
This commit is contained in:
parent
679d6e168d
commit
7348015d45
1 changed files with 6 additions and 1 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue