From acb288f9e7e9b325a997df5c9203fbcc28655fdf Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Tue, 15 Sep 2015 02:54:22 -0400 Subject: [PATCH] error handling when writing --- homeassistant/__main__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/homeassistant/__main__.py b/homeassistant/__main__.py index 1fa496c991b..dc405b54af4 100644 --- a/homeassistant/__main__.py +++ b/homeassistant/__main__.py @@ -179,8 +179,12 @@ def install_osx(): path = os.path.expanduser("~/Library/LaunchAgents/org.homeassistant.plist") - with open(path, 'w', encoding='utf-8') as outp: - outp.write(plist) + try: + with open(path, 'w', encoding='utf-8') as outp: + outp.write(plist) + except IOError as err: + print('Unable to write to ' + path, err) + return os.popen('launchctl load -w -F ' + path)