make youtokentome optional package, due to reported installation difficulties

This commit is contained in:
Phil Wang
2022-06-01 09:25:35 -07:00
parent 1ffeecd0ca
commit a851168633
5 changed files with 19 additions and 13 deletions

View File

@@ -17,3 +17,13 @@ class Timer:
def print_ribbon(s, symbol = '=', repeat = 40):
flank = symbol * repeat
return f'{flank} {s} {flank}'
# import helpers
def import_or_print_error(pkg_name, err_str = None):
try:
return importlib.import_module(pkg_name)
except ModuleNotFoundError as e:
if exists(err_str):
print(err_str)
exit()