summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--glucometerutils/support/freestyle.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py
index 9857086..307cf64 100644
--- a/glucometerutils/support/freestyle.py
+++ b/glucometerutils/support/freestyle.py
@@ -12,6 +12,7 @@ __license__ = 'MIT'
import csv
import datetime
+import os.path
import re
import struct
@@ -68,6 +69,9 @@ class FreeStyleHidDevice(object):
TEXT_REPLY_CMD = 0x60
def __init__(self, device):
+ if not os.path.exists(device):
+ raise exceptions.ConnectionFailed(
+ message='Path %s does not exist.' % device)
self.handle_ = open(device, 'w+b')
def connect(self):