Skip to content

Commit 1cce6de

Browse files
authored
Merge pull request #39 from ilario/importerror_i2c
Define I2C if busio.I2C import fails
2 parents f941cd1 + 3094ab3 commit 1cce6de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_ina219.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737

3838
from busio import I2C
3939
except ImportError:
40-
pass
40+
# define I2C to avoid the error:
41+
# def __init__(self, i2c_bus: I2C, addr: int = 0x40) -> None:
42+
# NameError: name 'I2C' is not defined
43+
I2C = None
4144

4245
__version__ = "0.0.0+auto.0"
4346
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_INA219.git"

0 commit comments

Comments
 (0)