Skip to content

Commit

Permalink
Ignore UTF-8 decoding errors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
flashcode committed Nov 10, 2013
1 parent 5315960 commit 87603e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gitchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import sys
import traceback

VERSION = '0.8'
VERSION = '0.9'


class GitChart:
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 87603e0

Please sign in to comment.