Mercurial > templog
diff py/sensor_test.py @ 232:a01b7bccccd3
improve exception handling
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 11 Apr 2015 21:09:13 +0800 |
parents | 185621f47040 |
children |
line wrap: on
line diff
--- a/py/sensor_test.py Sat Apr 11 00:16:05 2015 +0800 +++ b/py/sensor_test.py Sat Apr 11 21:09:13 2015 +0800 @@ -11,7 +11,7 @@ def make_vals(self): def try_read(f, fallback): try: - return open(f, 'r').read() + return float(open(f, 'r').read()) except Exception as e: return fallback @@ -22,7 +22,6 @@ return vals def run(self): - while True: yield from asyncio.sleep(1) vals = self.make_vals()