All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trevor Woerner <twoerner@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] moveconfig.py: add try…except
Date: Wed, 7 Apr 2021 13:15:49 -0400	[thread overview]
Message-ID: <20210407171549.GA27066@localhost> (raw)
In-Reply-To: <20210315160133.3463-1-twoerner@gmail.com>

It looks like Simon beat me to this one with 7570d9bb47be24d9d73518742703f32126af8113
but I'm hoping 2/2 can still make it in.

On Mon 2021-03-15 @ 12:01:32 PM, Trevor Woerner wrote:
> 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 <module>
> 	    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 <twoerner@gmail.com>
> ---
>  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
> 

      parent reply	other threads:[~2021-04-07 17:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 16:01 [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner
2021-03-15 16:01 ` [PATCH 2/2] moveconfig.py: add to the "do not process" list Trevor Woerner
2021-04-13 14:29   ` Tom Rini
2021-04-07 17:15 ` Trevor Woerner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210407171549.GA27066@localhost \
    --to=twoerner@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.