We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ba4be81 + a1d3eb2 commit 9874758Copy full SHA for 9874758
src/writer/csvwriter.py
@@ -44,6 +44,9 @@ def __init__(
44
self.path = self.path_prefix + '_' + '_'.join(self.path_suffix_parts) + '.csv'
45
self.delete = not csv_keep_file
46
47
+ def __del__(self):
48
+ self.destroy()
49
+
50
def opened(self):
51
return bool(self.file)
52
@@ -110,7 +113,8 @@ def close(self):
110
113
self.writer = None
111
114
112
115
def destroy(self):
- if self.delete:
116
+ if self.delete and os.path.isfile(self.path):
117
+ self.close()
118
os.remove(self.path)
119
120
if __name__ == '__main__':
0 commit comments