From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trevor Woerner Date: Mon, 15 Mar 2021 12:01:32 -0400 Subject: [PATCH 1/2] =?UTF-8?q?moveconfig.py:=20add=20try=E2=80=A6except?= Message-ID: <20210315160133.3463-1-twoerner@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de I keep getting a UnicodeDecodeError from one of the header files while modifying the headers: Traceback (most recent call last): File "tools/moveconfig.py", line 1953, in main() File "tools/moveconfig.py", line 1927, in main cleanup_headers(configs, options) File "tools/moveconfig.py", line 675, in cleanup_headers cleanup_one_header(header_path, patterns, options) File "tools/moveconfig.py", line 599, in cleanup_one_header lines = f.readlines() File "/usr/lib64/python3.6/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 9: invalid start byte I'm curious to know which header file is causing the problem. Signed-off-by: Trevor Woerner --- tools/moveconfig.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 9514d9a00c..dd92c00bb7 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -596,7 +596,12 @@ def cleanup_one_header(header_path, patterns, options): options: option flags. """ with open(header_path) as f: - lines = f.readlines() + try: + lines = f.readlines() + except: + print("caught exception: ", sys.exc_info()[0]) + print("header_path: ", header_path) + lines = "" matched = [] for i, line in enumerate(lines): -- 2.30.0.rc0