Skip to content

Commit 785f8ba

Browse files
authored
Merge pull request #6 from jerryneedell/jerryn_fix3x
fix OSError response for CP 3.0
2 parents f2bffec + ab3f7bd commit 785f8ba

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

adafruit_si7021.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ def __init__(self, i2c_bus, address=0x40):
7474
i2c.write(data, stop=False)
7575
i2c.readinto(data)
7676
value = data[0]
77-
except OSError as error:
78-
if error.args[0] not in ('I2C bus error', 19): # errno 19 ENODEV
79-
raise
77+
except OSError:
78+
pass
8079
else:
8180
break
8281
if value != _USER1_VAL:
@@ -96,9 +95,8 @@ def _data(self):
9695
try:
9796
with self.i2c_device as i2c:
9897
i2c.readinto(data)
99-
except OSError as error:
100-
if error.args[0] not in ('I2C bus error', 19): # errno 19 ENODEV
101-
raise
98+
except OSError:
99+
pass
102100
else:
103101
if data[0] != 0xff: # Check if read succeeded.
104102
break

0 commit comments

Comments
 (0)