From f5e57cdda39dec514e012b3c6a9fb07e5d7c9c80 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 5 Apr 2014 19:52:40 +0200 Subject: fix m bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- examples/comprehensive | 9 +++++---- examples/weather | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'examples') diff --git a/examples/comprehensive b/examples/comprehensive index 580d0bf..7510744 100644 --- a/examples/comprehensive +++ b/examples/comprehensive @@ -395,10 +395,11 @@ def periodically(year, month, day, hour, minute, second, weekday, fade): for condition in conditions: if condition in weather_modifiers: dayness *= weather_modifiers[condition] - _bound, visibility = metar[1] - if (visibility_max is not None) and (visibility is not None): - if visibility < visibility_max: - dayness *= visibility / visibility_max + if metar[1] is not None: + (_bound, visibility) = metar[1] + if (visibility_max is not None) and (visibility is not None): + if visibility < visibility_max: + dayness *= visibility / visibility_max # Do not do unnecessary work. if fade is None: diff --git a/examples/weather b/examples/weather index 3fac3e4..e65d0cf 100644 --- a/examples/weather +++ b/examples/weather @@ -60,10 +60,11 @@ if metar is not None: for condition in conditions: if condition in modifiers: dayness *= modifiers[condition] - _bound, visibility = metar[1] - if (visibility_max is not None) and (visibility is not None): - if visibility < visibility_max: - dayness *= visibility / visibility_max + if metar[1] is not None: + _bound, visibility = metar[1] + if (visibility_max is not None) and (visibility is not None): + if visibility < visibility_max: + dayness *= visibility / visibility_max # Calculation of the colour temperature. temp = temperature_day * dayness + temperature_night * (1 - dayness) -- cgit v1.2.3-70-g09d2