From 0b325b2b7de2a6841d4548730ff812dc404121ac Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 11 Dec 2015 18:43:00 -0800 Subject: [PATCH] API.stream - catch more errors --- homeassistant/components/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/api.py b/homeassistant/components/api.py index 6a66a2a110e..6d2f9e52a7a 100644 --- a/homeassistant/components/api.py +++ b/homeassistant/components/api.py @@ -126,7 +126,9 @@ def _handle_get_api_stream(handler, path_match, data): wfile.write(msg.encode("UTF-8")) wfile.flush() handler.server.sessions.extend_validation(session_id) - except IOError: + except (IOError, ValueError): + # IOError: socket errors + # ValueError: raised when 'I/O operation on closed file' block.set() def forward_events(event):