From e2d010e2ae9761418d5a59f79cc4b60a251665d5 Mon Sep 17 00:00:00 2001 From: Ciprian Manea Date: Sun, 4 Aug 2019 01:27:29 +0300 Subject: [PATCH] testing all examples, with corrections for Python3 support --- examples/all-in-one-no-pm.py | 2 +- examples/all-in-one.py | 2 +- examples/compensated-temperature.py | 3 +-- examples/luftdaten.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) mode change 100644 => 100755 examples/all-in-one-no-pm.py diff --git a/examples/all-in-one-no-pm.py b/examples/all-in-one-no-pm.py old mode 100644 new mode 100755 index 367ebeb..ab1a1a7 --- a/examples/all-in-one-no-pm.py +++ b/examples/all-in-one-no-pm.py @@ -78,7 +78,7 @@ def display_text(variable, data, unit): # Get the temperature of the CPU for compensation def get_cpu_temperature(): - process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) + process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True) output, _error = process.communicate() return float(output[output.index('=') + 1:output.rindex("'")]) diff --git a/examples/all-in-one.py b/examples/all-in-one.py index 8ba7681..6314137 100755 --- a/examples/all-in-one.py +++ b/examples/all-in-one.py @@ -84,7 +84,7 @@ def display_text(variable, data, unit): # Get the temperature of the CPU for compensation def get_cpu_temperature(): - process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) + process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True) output, _error = process.communicate() return float(output[output.index('=') + 1:output.rindex("'")]) diff --git a/examples/compensated-temperature.py b/examples/compensated-temperature.py index 048eb80..3679610 100755 --- a/examples/compensated-temperature.py +++ b/examples/compensated-temperature.py @@ -24,9 +24,8 @@ bme280 = BME280(i2c_dev=bus) # Get the temperature of the CPU for compensation def get_cpu_temperature(): - process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) + process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True) output, _error = process.communicate() - output = output.decode() return float(output[output.index('=') + 1:output.rindex("'")]) diff --git a/examples/luftdaten.py b/examples/luftdaten.py index 4d3d49a..c5b0387 100755 --- a/examples/luftdaten.py +++ b/examples/luftdaten.py @@ -71,7 +71,7 @@ def read_values(): # Get CPU temperature to use for compensation def get_cpu_temperature(): - process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) + process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True) output, _error = process.communicate() return float(output[output.index('=') + 1:output.rindex("'")]) -- 2.30.2