From 87603e0262748edb95bd88de52948cb543d39455 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 10 Nov 2013 15:51:42 +0100 Subject: [PATCH] Ignore UTF-8 decoding errors The script was throwing an error when building chart "authors" with Linux git repository (some names are not UTF-8 valid). The decoding errors are now ignored. --- gitchart.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitchart.py b/gitchart.py index 4212e51..e4eeed4 100755 --- a/gitchart.py +++ b/gitchart.py @@ -48,7 +48,7 @@ import sys import traceback -VERSION = '0.8' +VERSION = '0.9' class GitChart: @@ -103,12 +103,12 @@ def _git_command(self, command1, command2=None): p2 = subprocess.Popen(command2, stdin=p1.stdout, stdout=subprocess.PIPE) p1.stdout.close() - return p2.communicate()[0].decode('utf-8').strip().split('\n') + return p2.communicate()[0].decode('utf-8', errors='ignore').strip().split('\n') else: # execute a single git cmd and return output p = subprocess.Popen(command1, stdout=subprocess.PIPE, cwd=self.repository) - return p.communicate()[0].decode('utf-8').strip().split('\n') + return p.communicate()[0].decode('utf-8', errors='ignore').strip().split('\n') def _generate_bar_chart(self, data, sorted_keys=None, max_keys=0, max_x_labels=0, x_label_rotation=0):