def save_pickle(self, dumpfile=DUMPFILE):
if not self.changed:
self.note(0, "\nNo need to save checkpoint")
elif not dumpfile:
self.note(0, "No dumpfile, won't save checkpoint")
else:
self.note(0, "\nSaving checkpoint to %s ...", dumpfile)
newfile = dumpfile + ".new"
f = open(newfile, "wb")
pickle.dump(self, f)
f.close()
try:
os.unlink(dumpfile)
except os.error:
pass
os.rename(newfile, dumpfile)
self.note(0, "Done.")
return 1
评论列表
文章目录