bugfix: FileExistsError

This commit is contained in:
b3yond 2018-01-18 13:40:07 +01:00
parent 75e1ff902c
commit b5288f341c

View file

@ -55,8 +55,12 @@ class RetootBot(object):
def save_last(self):
""" save the last seen toot """
try:
with os.fdopen(os.open('seen_toots.pickle.part', os.O_WRONLY | os.O_EXCL | os.O_CREAT), 'wb') as f:
pickle.dump(self.seen_toots, f)
except FileExistsError:
with os.fdopen(os.open('seen_toots.pickle.part', os.O_WRONLY), 'wb') as f:
pickle.dump(self.seen_toots, f)
def crawl(self):
"""