allow modification of variable in child scope (#2688)

Fixes `NameError: name 'count' is not defined`
This commit is contained in:
Jesse O'Connor 2017-07-04 20:31:25 +10:00 committed by Fredrik Lindqvist
parent 717c2ab99e
commit 34009e3096

View File

@ -46,6 +46,7 @@ def setup(hass, config):
# Listener to handle fired events # Listener to handle fired events
def handle_event(event): def handle_event(event):
nonlocal count
count += 1 count += 1
print('Total events received:', count) print('Total events received:', count)