Mercurial > templog
comparison py/sensor_ds18b20.py @ 529:5201f441bf4a
run 2to3
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 10 Apr 2015 23:59:16 +0800 |
parents | dd8895652485 |
children | 659953f2ee03 |
comparison
equal
deleted
inserted
replaced
528:61e61de49a50 | 529:5201f441bf4a |
---|---|
63 temp = int(match.groups(1)[0]) / 1000.0 | 63 temp = int(match.groups(1)[0]) / 1000.0 |
64 if temp > 80: | 64 if temp > 80: |
65 E("Problem reading sensor '%s': %f" % (s, temp)) | 65 E("Problem reading sensor '%s': %f" % (s, temp)) |
66 return None | 66 return None |
67 return temp | 67 return temp |
68 except Exception, e: | 68 except Exception as e: |
69 EX("Problem reading sensor '%s': %s" % (s, str(e))) | 69 EX("Problem reading sensor '%s': %s" % (s, str(e))) |
70 return None | 70 return None |
71 | 71 |
72 def do_internal(self): | 72 def do_internal(self): |
73 try: | 73 try: |
74 return int(open(config.INTERNAL_TEMPERATURE, 'r').read()) / 1000.0 | 74 return int(open(config.INTERNAL_TEMPERATURE, 'r').read()) / 1000.0 |
75 except Exception, e: | 75 except Exception as e: |
76 EX("Problem reading internal sensor: %s" % str(e)) | 76 EX("Problem reading internal sensor: %s" % str(e)) |
77 return None | 77 return None |
78 | 78 |
79 | 79 |
80 def sensor_names(self): | 80 def sensor_names(self): |