From 0a274d3b0df92d169fab73e41914dc9d7f6d0440 Mon Sep 17 00:00:00 2001 From: Philip Boulain Date: Mon, 12 Apr 2021 22:52:43 +0100 Subject: [PATCH] Decode CPU temperature for Python 3 support This ports the changes from https://github.com/pimoroni/enviroplus-python/pull/23 , where this same function is copied. --- examples/compensated-temperature.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/compensated-temperature.py b/examples/compensated-temperature.py index 6cd946b..807d353 100755 --- a/examples/compensated-temperature.py +++ b/examples/compensated-temperature.py @@ -25,6 +25,7 @@ def get_cpu_temperature(): process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) output, _error = process.communicate() + output = output.decode() return float(output[output.index('=') + 1:output.rindex("'")]) factor = 0.6 # Smaller numbers adjust temp down, vice versa