Skip to content

fix OSError response for CP 3.0 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions adafruit_si7021.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down