Skip to content

Commit

Permalink
Clean up the logging to respect settings. Re-enable the use of SUDO w…
Browse files Browse the repository at this point in the history
…hen set.
  • Loading branch information
KeirRice committed Sep 25, 2022
1 parent d6be2b1 commit 7a445e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions octoprint_enclosure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,16 +1144,16 @@ def read_shtc3_temp(self, address, i2cbus):
try:
script = os.path.dirname(os.path.realpath(__file__)) + "/SHTC3.py"
cmd = [sys.executable, script, str(i2cbus), str(address)]
# if self._settings.get(["use_sudo"]):
# cmd.insert(0, "sudo")
if self._settings.get(["use_sudo"]):
cmd.insert(0, "sudo")

if self._settings.get(["debug_temperature_log"]) is True:
self._logger.debug("Temperature SHTC3 cmd: %s", " ".join(cmd))

stdout = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
output, errors = stdout.communicate()

if True or self._settings.get(["debug_temperature_log"]) is True:
if self._settings.get(["debug_temperature_log"]) is True:
if len(errors) > 0:
self._logger.error("SHTC3 error: %s", errors)
else:
Expand Down

0 comments on commit 7a445e0

Please sign in to comment.