Skip to content

Commit 069f12c

Browse files
committed
Update examples to also catch RuntimeError on init
1 parent a8a2266 commit 069f12c

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

examples/compensated-temperature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
try:
1717
sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)
18-
except IOError:
18+
except (RuntimeError, IOError):
1919
sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)
2020

2121
# These oversampling settings can be tweaked to

examples/indoor-air-quality.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
try:
1717
sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)
18-
except IOError:
18+
except (RuntimeError, IOError):
1919
sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)
2020

2121
# These oversampling settings can be tweaked to

examples/read-all.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
try:
1313
sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)
14-
except IOError:
14+
except (RuntimeError, IOError):
1515
sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)
1616

1717
# These calibration data can safely be commented

examples/temperature-offset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
try:
1212
sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)
13-
except IOError:
13+
except (RuntimeError, IOError):
1414
sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)
1515

1616
# These oversampling settings can be tweaked to

examples/temperature-pressure-humidity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
try:
1515
sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)
16-
except IOError:
16+
except (RuntimeError, IOError):
1717
sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)
1818

1919
# These oversampling settings can be tweaked to

0 commit comments

Comments
 (0)