From 6fb941569bff411e2be308d6b669ae3563e13e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sat, 15 Apr 2017 15:27:58 +0100 Subject: glucometer: log a better error if the driver name is not found. --- glucometer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/glucometer.py b/glucometer.py index 63ea8fc..5d75bcb 100755 --- a/glucometer.py +++ b/glucometer.py @@ -59,7 +59,14 @@ def main(): logging.basicConfig(level=args.vlog) - driver = importlib.import_module('glucometerutils.drivers.' + args.driver) + try: + driver = importlib.import_module('glucometerutils.drivers.' + args.driver) + except ImportError: + logging.error( + 'No driver "%s" found, please check your --driver parameter.', + args.driver) + return 1 + device = driver.Device(args.device) device.connect() -- cgit v1.2.3