Write new file to a temporary and move it afterwards.

alfred-data
Daniel Ehlers 2014-01-01 18:59:33 +01:00
parent 53d8f4bcf2
commit 33d7b3aefc
1 changed files with 5 additions and 1 deletions

View File

@ -67,6 +67,10 @@ rrd.update_images()
m = D3MapBuilder(db)
nodes_json = open(options['destination_directory'] + '/nodes.json','w')
#Write nodes json
nodes_json = open(options['destination_directory'] + '/nodes.json.new','w')
nodes_json.write(m.build())
nodes_json.close()
#Move to destination
os.rename(options['destination_directory'] + '/nodes.json.new',options['destination_directory'] + '/nodes.json')