summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
09ab09f)
Script was exiting early. Adding exception handling in case
`read_temp()` fails.
while True:
nowTimeIso8601 = strftime("%Y%m%dT%H%M%S%z")
nowTimeUE = strftime("%s")
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), flush=True) # flush to stdout continuously (e.g. without buffer) https://stackoverflow.com/a/14729823
- time.sleep(10)
+ try:
+ nowTemp = read_temp()
+ print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + str(nowTemp), flush=True) # flush to stdout continuously (e.g. without buffer) https://stackoverflow.com/a/14729823
+ except Exception as e:
+ print(str(nowTimeIso8601) + ',' + str(nowTimeUE) + ',' + str(myHostname) + ',' + 'ERROR:' + str(e), flush=True)
+ finally:
+ time.sleep(10)