From daad122236f7eca841e9a46fa19dd57f44bcb5ac Mon Sep 17 00:00:00 2001 From: lamkin <88649589+lamkin@users.noreply.github.com> Date: Mon, 16 Aug 2021 16:46:32 +0100 Subject: [PATCH] Ignore bad encoding in email addresses when parsing maillog files (#2017) local/domain parts of email address should be standard ASCII or UTF-8. Some email addresses contain extended ASCII, leading to decode failure by the UTF-8 codec (and thus failure of the Usage-Report script) This change allows maillog parsing to continue over lines containing such addresses --- management/mail_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/mail_log.py b/management/mail_log.py index 1626f820..59c32c6e 100755 --- a/management/mail_log.py +++ b/management/mail_log.py @@ -586,7 +586,7 @@ def scan_postfix_submission_line(date, log, collector): def readline(filename): """ A generator that returns the lines of a file """ - with open(filename) as file: + with open(filename, errors='replace') as file: while True: line = file.readline() if not line: