Explorar el Código

Fixed spurious encoding error

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.
Christopher Haster hace 3 años
padre
commit
e4adefd1d7
Se han modificado 3 ficheros con 6 adiciones y 3 borrados
  1. 2 1
      scripts/code.py
  2. 2 1
      scripts/data.py
  3. 2 1
      scripts/structs.py

+ 2 - 1
scripts/code.py

@@ -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:

+ 2 - 1
scripts/data.py

@@ -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:

+ 2 - 1
scripts/structs.py

@@ -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)