From 2c90177d7ee6643ae0c8f9db3e1fbac4c7d2fd7d Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Wed, 24 Apr 2019 16:37:15 -0500 Subject: [PATCH] added check to see if termux-toast is available --- main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 0c30140..2ac520f 100755 --- a/main.py +++ b/main.py @@ -14,6 +14,8 @@ import subprocess # for logging import os.path as osp import sys +import shutil +HAS_TOAST = shutil.which('termux-toast') is not None CHICAGO_TZ = tz.gettz("America/Chicago") DATETIME_FORMAT = "%A, %B %e, %Y %H:%M:%S" # https://stackoverflow.com/a/5967539 @@ -194,7 +196,7 @@ def main(args): _done = False while not _done: try: - show(data, args.route, True, args.disable_toast) + show(data, args.route, True, args.disable_toast and HAS_TOAST) s = time.perf_counter() timeout = 1 if args.periodic > timeout: