From 6cdaa8b428ec58b4bffadde328d84dfb81405b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20HERVIER?= Date: Tue, 6 Oct 2015 16:23:00 +0200 Subject: [PATCH] Use int instead of eval and in a try except. My clio 3 1.2 16v (2015) seems to send blank str sometime which prevent any reading of DTC --- obd_sensors.py | 5 ++++- pyobd | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/obd_sensors.py b/obd_sensors.py index 59b58329..fe1ddab7 100644 --- a/obd_sensors.py +++ b/obd_sensors.py @@ -23,7 +23,10 @@ ########################################################################### def hex_to_int(str): - i = eval("0x" + str, {}, {}) + try: + i = int("0x" + str, 16) + except: + return 0 return i def maf(code): diff --git a/pyobd b/pyobd index dbc3b4e7..5790dab0 100755 --- a/pyobd +++ b/pyobd @@ -357,7 +357,7 @@ class MyApp(wx.App): else: self.configfilepath=os.environ['HOME']+'/.pyobdrc' if self.config.read(self.configfilepath)==[]: - self.COMPORT="/dev/ttyACM0" + self.COMPORT="/dev/ttyUSB0" self.RECONNATTEMPTS=5 self.SERTIMEOUT=2 else: