Skip to content

Commit 87603e0

Browse files
committed
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.
1 parent 5315960 commit 87603e0

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

gitchart.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import sys
4949
import traceback
5050

51-
VERSION = '0.8'
51+
VERSION = '0.9'
5252

5353

5454
class GitChart:
@@ -103,12 +103,12 @@ def _git_command(self, command1, command2=None):
103103
p2 = subprocess.Popen(command2, stdin=p1.stdout,
104104
stdout=subprocess.PIPE)
105105
p1.stdout.close()
106-
return p2.communicate()[0].decode('utf-8').strip().split('\n')
106+
return p2.communicate()[0].decode('utf-8', errors='ignore').strip().split('\n')
107107
else:
108108
# execute a single git cmd and return output
109109
p = subprocess.Popen(command1, stdout=subprocess.PIPE,
110110
cwd=self.repository)
111-
return p.communicate()[0].decode('utf-8').strip().split('\n')
111+
return p.communicate()[0].decode('utf-8', errors='ignore').strip().split('\n')
112112

113113
def _generate_bar_chart(self, data, sorted_keys=None, max_keys=0,
114114
max_x_labels=0, x_label_rotation=0):

0 commit comments

Comments
 (0)