Don't crash if LocalStatus file doesn't exist yet

Closes: #470174
This commit is contained in:
John Goerzen 2008-03-09 20:27:37 -05:00
parent db805043f2
commit cf1a1b31e2

View File

@ -43,7 +43,10 @@ class LocalStatusRepository(BaseRepository):
file = open(filename + ".tmp", "wb") file = open(filename + ".tmp", "wb")
file.write(offlineimap.folder.LocalStatus.magicline + '\n') file.write(offlineimap.folder.LocalStatus.magicline + '\n')
file.close() file.close()
try:
os.unlink(filename) os.unlink(filename)
except:
pass
os.rename(filename + ".tmp", filename) os.rename(filename + ".tmp", filename)
# Invalidate the cache. # Invalidate the cache.