From ab3f7bd271192a632b52acb27238569b074147ce Mon Sep 17 00:00:00 2001 From: Jerry Needell Date: Thu, 28 Dec 2017 12:52:07 -0500 Subject: [PATCH] fix OSError response for CP 3.0 --- adafruit_si7021.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/adafruit_si7021.py b/adafruit_si7021.py index 9a26d04..e8175d4 100644 --- a/adafruit_si7021.py +++ b/adafruit_si7021.py @@ -74,9 +74,8 @@ def __init__(self, i2c_bus, address=0x40): i2c.write(data, stop=False) i2c.readinto(data) value = data[0] - except OSError as error: - if error.args[0] not in ('I2C bus error', 19): # errno 19 ENODEV - raise + except OSError: + pass else: break if value != _USER1_VAL: @@ -96,9 +95,8 @@ def _data(self): try: with self.i2c_device as i2c: i2c.readinto(data) - except OSError as error: - if error.args[0] not in ('I2C bus error', 19): # errno 19 ENODEV - raise + except OSError: + pass else: if data[0] != 0xff: # Check if read succeeded. break