prevent crash that occurs when changing models.yaml on windows systems

Windows does not support an atomic `os.rename()` operation. This
PR changes it to `os.replace()`, which does the same thing.
This commit is contained in:
Lincoln Stein
2022-11-25 16:37:54 +00:00
parent dba0280790
commit 8f3f64b22e
3 changed files with 5 additions and 5 deletions

View File

@@ -298,7 +298,7 @@ class ModelCache(object):
with open(tmpfile, 'w') as outfile:
outfile.write(self.preamble())
outfile.write(yaml_str)
os.rename(tmpfile,config_file_path)
os.replace(tmpfile,config_file_path)
def preamble(self):
'''