[Git][NTPsec/ntpsec][master] ntpviz: work around a python bug in rename()

Gary E. Miller gitlab at mg.gitlab.com
Tue Oct 18 01:37:19 UTC 2016


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
809b8b46 by Gary E. Miller at 2016-10-17T18:35:54-07:00
ntpviz: work around a python bug in rename()

Python 2.7 and 3.6 os.rename() does not work on Windows if the
destination exists...

- - - - -


1 changed file:

- ntpstats/ntpviz


Changes:

=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -1491,7 +1491,11 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
             csv_ob.writerow(row)
 
     # move new index and summary into place
+    # windows python 2.7, 3.6 has no working rename, so delete and move
+    os.remove(csv_filename)
     os.rename( csv_filename + ".tmp", csv_filename)
+
+    ow.remove( index_filename)
     os.rename( index_filename + ".tmp", index_filename)
 
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/809b8b461e26833840e2ddebdafea5bf45bf1f1b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161018/2ea5bf62/attachment.html>


More information about the vc mailing list