Browse Source

Raise an error if WG1220 is not responding

Matthias Vogelgesang 8 years ago
parent
commit
a40c051a29
1 changed files with 4 additions and 0 deletions
  1. 4 0
      wg1220.py

+ 4 - 0
wg1220.py

@@ -37,6 +37,10 @@ class Generator(object):
 
         self.conn.write(message)
         result = self.conn.read(7)
+
+        if len(result) == 0:
+            raise IOError("No result returned")
+
         log.debug("recv {}".format(fmt(result)))
 
         if checksum(result[1:6]) != ord(result[6]):