Skip to content

Commit

Permalink
Added some retrying
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjensen committed Jun 22, 2018
1 parent c35a24f commit 9e51728
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion machines/rasppi80/datalogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ def value(self, channel):
def run(self):
while not self.quit:
self.ttl = 50
self.humidity, self.temperature = self.honeywell.read_values()
for n in range(10):
try:
self.humidity, self.temperature = self.honeywell.read_values()
break
except OSError:
time.sleep(5)
else:
raise RuntimeError("Ran out of retries")

def main():
""" Main function """
Expand Down

0 comments on commit 9e51728

Please sign in to comment.