Skip to content

Commit 5844a0f

Browse files
committed
delete file after process
1 parent b469e71 commit 5844a0f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from kafka_lib import ProducerThread, ConsumerThread
55
from log_analyser.log_analyser import LogAnalyser
66
import configparser
7+
import os
78

89

910
class DatastrikePythonProcessing:
@@ -47,6 +48,10 @@ def on_callback_test(self, topic, data):
4748
self.producer_thread.send("analyse.report", {"error": "{}".format(e)})
4849
else:
4950
self.producer_thread.send("analyse.report", {"error": "File extension not correct"})
51+
try:
52+
os.remove("{}/{}".format(filePath, fileName))
53+
except Exception as e:
54+
print("Error remove file : {}".format(e))
5055

5156
def check_txt_extension(self, filename):
5257
return filename.lower().endswith('.txt')

0 commit comments

Comments
 (0)