diff --git a/homely/_ui.py b/homely/_ui.py
index <HASH>..<HASH> 100644
--- a/homely/_ui.py
+++ b/homely/_ui.py
@@ -420,7 +420,11 @@ def setcurrentrepo(info):
 def _write(path, content):
     with open(path + ".new", 'w') as f:
         f.write(content)
-    os.replace(path + ".new", path)
+    if sys.version_info[0] < 3:
+        # use the less-reliable os.rename() on python2
+        os.rename(path + ".new", path)
+    else:
+        os.replace(path + ".new", path)
 
 
 _PREV_SECTION = []
[9] homely._ui: python2 doesn't have os.replace()