From: Steven Baltakatei Sandoval Date: Wed, 28 Oct 2020 21:04:11 +0000 (+0000) Subject: fix(exec/temp):Remove buffer from poll py script to enable piping X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/commitdiff_plain/f9377ba1f918032fa9fa777c3d0be764dd1256ee?ds=inline;hp=12b6bcb3d04144c9edddb3f76177fc9555918ed1 fix(exec/temp):Remove buffer from poll py script to enable piping --- diff --git a/exec/temperature/DS18B20..temp_poll.py b/exec/temperature/DS18B20..temp_poll.py index 831e4aa..524bc96 100755 --- a/exec/temperature/DS18B20..temp_poll.py +++ b/exec/temperature/DS18B20..temp_poll.py @@ -1,4 +1,8 @@ #!/usr/bin/env python3 +# Desc: Prints time and temperature reading +# Output: [date (ISO-8601)],[date (Unix Epoch)],[temp (°C)] +# Depends: python 3.3 +# Ref/Attrib: Raspberry Pi Temprature Sensor using the DS18B20; https://pimylifeup.com/raspberry-pi-temperature-sensor/ import os import glob @@ -40,5 +44,5 @@ while True: nowTimeIso8601 = strftime("%Y%m%dT%H%M%S%z") nowTimeUE = strftime("%s") nowTemp = read_temp() - print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + str(nowTemp)) + print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + str(nowTemp), flush=True) # flush to stdout continuously (e.g. without buffer) https://stackoverflow.com/a/14729823 time.sleep(1)