testing all examples, with corrections for Python3 support
authorCiprian Manea <ciprian.manea@gmail.com>
Sat, 3 Aug 2019 22:27:29 +0000 (01:27 +0300)
committerCiprian Manea <ciprian.manea@gmail.com>
Sat, 3 Aug 2019 22:36:45 +0000 (01:36 +0300)
examples/all-in-one-no-pm.py [changed mode: 0644->0755]
examples/all-in-one.py
examples/compensated-temperature.py
examples/luftdaten.py

old mode 100644 (file)
new mode 100755 (executable)
index 367ebeb..ab1a1a7
@@ -78,7 +78,7 @@ def display_text(variable, data, unit):
 
 # Get the temperature of the CPU for compensation
 def get_cpu_temperature():
 
 # 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("'")])
 
     output, _error = process.communicate()
     return float(output[output.index('=') + 1:output.rindex("'")])
 
index 8ba76815b25347a48d70f8d3d26dfdcdf90b319e..6314137e4dfb4109740ec33f1ba70e1e2bb891d6 100755 (executable)
@@ -84,7 +84,7 @@ def display_text(variable, data, unit):
 
 # Get the temperature of the CPU for compensation
 def get_cpu_temperature():
 
 # 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("'")])
 
     output, _error = process.communicate()
     return float(output[output.index('=') + 1:output.rindex("'")])
 
index 048eb804fde2096a7c170bef086a94d8258ec4d0..367961003a6cd90afdcd0251f3e6d04e4ff90887 100755 (executable)
@@ -24,9 +24,8 @@ bme280 = BME280(i2c_dev=bus)
 
 # Get the temperature of the CPU for compensation
 def get_cpu_temperature():
 
 # 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, _error = process.communicate()
-    output = output.decode()
     return float(output[output.index('=') + 1:output.rindex("'")])
 
 
     return float(output[output.index('=') + 1:output.rindex("'")])
 
 
index 4d3d49acd87a86dae17d79f51981f67d75fc261a..c5b03873356bbdca7a808ab0f29729e6f4b88501 100755 (executable)
@@ -71,7 +71,7 @@ def read_values():
 
 # Get CPU temperature to use for compensation
 def get_cpu_temperature():
 
 # 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("'")])
 
     output, _error = process.communicate()
     return float(output[output.index('=') + 1:output.rindex("'")])