Import BugFix for DEBUG-Mode

This commit is contained in:
Dirk Alders 2020-09-18 16:32:14 +02:00
parent 859b5dec67
commit 5ffef8254a
3 changed files with 30 additions and 7 deletions

15
.gitignore vendored
View File

@ -114,3 +114,18 @@ dmypy.json
# Pyre type checker
.pyre/
# ---> Linux
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*

11
bmp.py
View File

@ -1,8 +1,13 @@
import time
from . import logger, background_task, DEBUG
if not DEBUG:
import smbus
from . import logger, background_task
try:
import smbus
except ImportError:
logger.warning("Could not import smbus. DEBUG set to True.")
DEBUG = True
else:
from . import DEBUG
class bmp_180(background_task):

11
dht.py
View File

@ -1,10 +1,13 @@
import time
from . import logger, background_task, DEBUG
if not DEBUG:
from . import logger, background_task
try:
import adafruit_dht
except ImportError:
logger.warning("Could not import adafruit_dht. DEBUG set to True")
DEBUG = True
else:
from . import DEBUG
class dht_22(background_task):
RUN_SLEEP_TIME = 2.0