fix exception handling
authorlb1programmer <luke@linuxpc>
Wed, 20 Jun 2012 23:00:41 +0000 (19:00 -0400)
committerPeter Harris <git@peter.is-a-geek.org>
Wed, 20 Jun 2012 23:00:58 +0000 (19:00 -0400)
obd_io.py

index 1112ef5..7dd6d1c 100644 (file)
--- a/obd_io.py
+++ b/obd_io.py
@@ -89,7 +89,8 @@ class OBDPort:
              self.port = serial.Serial(portnum,baud, \
              parity = par, stopbits = sb, bytesize = databits,timeout = to)
              
-         except serial.SerialException:
+         except serial.SerialException as e:
+             print e
              self.State = 0
              return None
              
@@ -139,7 +140,8 @@ class OBDPort:
          
          # 9 seems to be the length of the shortest valid response
          if len(code) < 7:
-             raise "BogusCode"
+             #raise Exception("BogusCode")
+             print "boguscode?"+code
          
          # get the first thing returned, echo should be off
          code = string.split(code, "\r")
@@ -295,4 +297,4 @@ class OBDPort:
                     line = "%.6f,\t%s\n" % (now - start_time, data[1])
                     file.write(line)
                     file.flush()
-          
\ No newline at end of file
+