summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-04-15 16:27:58 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-04-15 16:27:58 +0200
commit6fb941569bff411e2be308d6b669ae3563e13e3c (patch)
tree80c8c94f175c353318850eac7035b93491d717e1
parentall drivers: make --device optional at the tool level. (diff)
downloadglucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.tar
glucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.tar.gz
glucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.tar.bz2
glucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.tar.lz
glucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.tar.xz
glucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.tar.zst
glucometerutils-6fb941569bff411e2be308d6b669ae3563e13e3c.zip
-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()