OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Bug in weather_level_adj.py plugin › Reply To: Bug in weather_level_adj.py plugin
ShawnHarte
I see what is happening now, except: is a catch all, if you would like to only extend the sleep when certain errors happen, use the applicable exception for example:
try:
//some code you hope works
except (TypeError, ValueError):
//increased sleep time
except:
//something else happened leave sleep time alone and do whatever you do for errors
A list of all exceptions can be found in the python documentation, if you simply want to ignore errors use except: pass
I think simply handling certain errors appropriately would do wonders for you and would be quite simple to implement. Python has a ton of code built in for handling problems, seems to be designed for writing code assuming everything will work, then just quickly deal with whatever goes wrong. Easier to ask forgiveness than permission, type programming.