changeset 495:905bbab632f7

Make sure we close descriptor before rename
author Matt Johnston <matt@ucc.asn.au>
date Wed, 12 Feb 2014 20:57:30 +0800
parents 1800a07f20e0
children 88204c0db5fa 455f19b64e0f
files py/receive.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/py/receive.py	Tue Feb 11 23:48:35 2014 +0800
+++ b/py/receive.py	Wed Feb 12 20:57:30 2014 +0800
@@ -44,8 +44,10 @@
             delete = False)
 
         t.write(json.dumps(new_params, sort_keys=True, indent=4)+'\n')
+        name = t.name
+        t.close()
 
-        os.rename(t.name, config.PARAMS_FILE)
+        os.rename(name, config.PARAMS_FILE)
     except Exception, e:
         return "Problem: %s" % e