summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2017-05-30 14:35:52 +0200
committerGitHub <noreply@github.com>2017-05-30 14:35:52 +0200
commit86d0ce8453e577a4e6652c2d8b91ba95fef5d99f (patch)
tree3f19e6d49849f97764bb08c2e994b5f45dd9f769
parentMerge pull request #12 from DorianScholz/show_import_error (diff)
parentMake dateutil optional: (diff)
downloadglucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.tar
glucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.tar.gz
glucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.tar.bz2
glucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.tar.lz
glucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.tar.xz
glucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.tar.zst
glucometerutils-86d0ce8453e577a4e6652c2d8b91ba95fef5d99f.zip
-rwxr-xr-xglucometer.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/glucometer.py b/glucometer.py
index c037d7c..5440f0d 100755
--- a/glucometer.py
+++ b/glucometer.py
@@ -13,8 +13,6 @@ import inspect
import logging
import sys
-from dateutil import parser as date_parser
-
from glucometerutils import common
from glucometerutils import exceptions
@@ -108,7 +106,11 @@ def main():
print(device.set_datetime())
elif args.set:
try:
+ from dateutil import parser as date_parser
new_date = date_parser.parse(args.set)
+ except ImportError:
+ logging.error('could not import module "dateutil", please install it.')
+ return 1
except ValueError:
logging.error('%s: not a valid date', args.set)
return 1