added check on constants.__dict__ for micropython support (#18)

* added check on constants.__dict__ for micropython support
This commit is contained in:
Giampiero Baggiani 2018-12-10 10:55:07 +01:00 committed by Philip Howard
parent e97c5f9241
commit e827e5d622
1 changed files with 5 additions and 4 deletions

View File

@ -10,10 +10,11 @@ __version__ = '1.0.5'
# Export constants to global namespace
# so end-users can "from BME680 import NAME"
for key in constants.__dict__:
value = constants.__dict__[key]
if key not in globals():
globals()[key] = value
if hasattr(constants, '__dict__'):
for key in constants.__dict__:
value = constants.__dict__[key]
if key not in globals():
globals()[key] = value
class BME680(BME680Data):