From ffeae482fbf9f8411f3867086bc336d61dab42d2 Mon Sep 17 00:00:00 2001 From: Waldek Date: Mon, 4 Jan 2021 18:20:02 +0100 Subject: [PATCH] Fixed problem whth crash write file lastheard.log --- monitor.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/monitor.py b/monitor.py index b3c5bc0..e488f60 100644 --- a/monitor.py +++ b/monitor.py @@ -35,6 +35,7 @@ import datetime import os import csv from itertools import islice +from subprocess import check_call, CalledProcessError # Twisted modules from twisted.internet.protocol import ReconnectingClientFactory, Protocol @@ -632,6 +633,10 @@ def process_message(_bmessage): lh_logfile = open(LOG_PATH+"lastheard.log", "a") lh_logfile.write(log_lh_message + '\n') lh_logfile.close() + try: + check_call("sed -i -e 's|\\x0||g' {}".format(LOG_PATH+"lastheard.log"), shell=True) + except CalledProcessError as err: + print(err) # Lastheard in Dashboard by SP2ONG my_list=[] n=0