From ba79b1504fea1447d912cfe4e5d61529288a8048 Mon Sep 17 00:00:00 2001 From: Waldek Date: Mon, 7 Jun 2021 21:56:29 +0200 Subject: [PATCH] fixed problem with non-UTF-8 chars in lastherad.log --- monitor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/monitor.py b/monitor.py index d0c48ff..0a33aa3 100644 --- a/monitor.py +++ b/monitor.py @@ -773,18 +773,18 @@ def process_message(_bmessage): # use >=0 instead of >2 if you want to record all activities if int(float(p[9])) > 2: log_lh_message = '{},{},{},{},{},{},{},TS{},TG{},{},{},{}'.format(_now, p[9], p[0], p[1], p[3], p[5], alias_call(int(p[5]), subscriber_ids), p[7], p[8],alias_tgid(int(p[8]),talkgroup_ids),p[6], alias_short(int(p[6]), subscriber_ids)) - lh_logfile = open(LOG_PATH+"lastheard.log", "a") + lh_logfile = open(LOG_PATH+"lastheard.log", "a", encoding="UTF-8", errors="ignore") lh_logfile.write(log_lh_message + '\n') lh_logfile.close() # Lastheard in Dashboard by SP2ONG my_list=[] n=0 - f = open(PATH+"templates/lastheard.html", "w") + f = open(PATH+"templates/lastheard.html", "w", encoding="UTF-8", errors="ignore") f.write("
\n") f.write(" .: Lastheard :. \n") f.write("\n") f.write("\n") - with open(LOG_PATH+"lastheard.log", "r") as textfile: + with open(LOG_PATH+"lastheard.log", "r", encoding="UTF-8", errors="ignore") as textfile: for row in islice(reversed(list(csv.reader(textfile))),200): duration=row[1] dur=str(int(float(duration.strip())))
DateTimeCallsign (DMR-Id)NameTG#TG NameTX (s)System