summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xglucometer.py9
1 files changed, 8 insertions, 1 deletions
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()