Import BugFix for DEBUG-Mode
This commit is contained in:
parent
859b5dec67
commit
5ffef8254a
15
.gitignore
vendored
15
.gitignore
vendored
@ -114,3 +114,18 @@ dmypy.json
|
|||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.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
11
bmp.py
@ -1,8 +1,13 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from . import logger, background_task, DEBUG
|
from . import logger, background_task
|
||||||
if not DEBUG:
|
try:
|
||||||
import smbus
|
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):
|
class bmp_180(background_task):
|
||||||
|
11
dht.py
11
dht.py
@ -1,10 +1,13 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from . import logger, background_task, DEBUG
|
from . import logger, background_task
|
||||||
|
try:
|
||||||
if not DEBUG:
|
|
||||||
import adafruit_dht
|
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):
|
class dht_22(background_task):
|
||||||
RUN_SLEEP_TIME = 2.0
|
RUN_SLEEP_TIME = 2.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user