From e827e5d622fd70df2aee6a68ebac626cf539ee55 Mon Sep 17 00:00:00 2001 From: Giampiero Baggiani Date: Mon, 10 Dec 2018 10:55:07 +0100 Subject: [PATCH] added check on constants.__dict__ for micropython support (#18) * added check on constants.__dict__ for micropython support --- library/bme680/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/bme680/__init__.py b/library/bme680/__init__.py index 62aa7ea..61641ec 100644 --- a/library/bme680/__init__.py +++ b/library/bme680/__init__.py @@ -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):