Only remove output file if it exists before writing to it in txt output

This commit is contained in:
John Schember 2009-03-21 07:37:26 -04:00
parent 36fd295ca1
commit 8d124f92d6

View File

@ -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'))