Skip to content

Commit

Permalink
Fixed spurious encoding error
Browse files Browse the repository at this point in the history
Using errors=replace in python utf-8 decoding makes these scripts more
resilient to underlying errors, rather than just throwing an unhelpfully
generic decode error.
  • Loading branch information
geky committed Mar 20, 2022
1 parent 9d54603 commit e4adefd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion scripts/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def collect(paths, **args):
proc = sp.Popen(cmd,
stdout=sp.PIPE,
stderr=sp.PIPE if not args.get('verbose') else None,
universal_newlines=True)
universal_newlines=True,
errors='replace')
for line in proc.stdout:
m = pattern.match(line)
if m:
Expand Down
3 changes: 2 additions & 1 deletion scripts/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def collect(paths, **args):
proc = sp.Popen(cmd,
stdout=sp.PIPE,
stderr=sp.PIPE if not args.get('verbose') else None,
universal_newlines=True)
universal_newlines=True,
errors='replace')
for line in proc.stdout:
m = pattern.match(line)
if m:
Expand Down
3 changes: 2 additions & 1 deletion scripts/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def collect(paths, **args):
proc = sp.Popen(cmd,
stdout=sp.PIPE,
stderr=sp.PIPE if not args.get('verbose') else None,
universal_newlines=True)
universal_newlines=True,
errors='replace')
for line in proc.stdout:
# state machine here to find structs
m = pattern.match(line)
Expand Down

0 comments on commit e4adefd

Please sign in to comment.