diff --git a/src/calibre/ebooks/txt/writer.py b/src/calibre/ebooks/txt/writer.py index 0fbf4a634c..84376ca2e7 100644 --- a/src/calibre/ebooks/txt/writer.py +++ b/src/calibre/ebooks/txt/writer.py @@ -53,7 +53,8 @@ class TXTWriter(object): for i in range(3 - end.count(self.newline)): tmpout = tmpout + self.newline - os.remove(path) + if os.path.exists(path): + os.remove(path) with open(path, 'w+b') as out: out.write(tmpout.encode('utf-8'))