mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Only remove output file if it exists before writing to it in txt output
This commit is contained in:
parent
36fd295ca1
commit
8d124f92d6
@ -53,7 +53,8 @@ class TXTWriter(object):
|
|||||||
for i in range(3 - end.count(self.newline)):
|
for i in range(3 - end.count(self.newline)):
|
||||||
tmpout = tmpout + self.newline
|
tmpout = tmpout + self.newline
|
||||||
|
|
||||||
os.remove(path)
|
if os.path.exists(path):
|
||||||
|
os.remove(path)
|
||||||
with open(path, 'w+b') as out:
|
with open(path, 'w+b') as out:
|
||||||
out.write(tmpout.encode('utf-8'))
|
out.write(tmpout.encode('utf-8'))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user