Skip to content

Commit e2d010e

Browse files
committed
testing all examples, with corrections for Python3 support
1 parent a73ee78 commit e2d010e

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

examples/all-in-one-no-pm.py

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def display_text(variable, data, unit):
7878

7979
# Get the temperature of the CPU for compensation
8080
def get_cpu_temperature():
81-
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
81+
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
8282
output, _error = process.communicate()
8383
return float(output[output.index('=') + 1:output.rindex("'")])
8484

examples/all-in-one.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def display_text(variable, data, unit):
8484

8585
# Get the temperature of the CPU for compensation
8686
def get_cpu_temperature():
87-
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
87+
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
8888
output, _error = process.communicate()
8989
return float(output[output.index('=') + 1:output.rindex("'")])
9090

examples/compensated-temperature.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424

2525
# Get the temperature of the CPU for compensation
2626
def get_cpu_temperature():
27-
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
27+
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
2828
output, _error = process.communicate()
29-
output = output.decode()
3029
return float(output[output.index('=') + 1:output.rindex("'")])
3130

3231

examples/luftdaten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def read_values():
7171

7272
# Get CPU temperature to use for compensation
7373
def get_cpu_temperature():
74-
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE)
74+
process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE, universal_newlines=True)
7575
output, _error = process.communicate()
7676
return float(output[output.index('=') + 1:output.rindex("'")])
7777

0 commit comments

Comments
 (0)