Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal encoding error when running on Yosemite #54

Closed
GoogleCodeExporter opened this issue Aug 23, 2015 · 3 comments
Closed

Terminal encoding error when running on Yosemite #54

GoogleCodeExporter opened this issue Aug 23, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. run it from terminal
2.
3.

What is the expected output? What do you see instead?
$ python gitinspector.py ~/repos/joniab/
Statistical information for the repository 'joniab' was gathered on 2014/12/26.
The following historical commit information, by author, was found in the
repository:

Author                     Commits    Insertions      Deletions    % of changes
Niklas                           4           554             48           10.26
Niklas Osterlund                33          2256            685           50.14
Traceback (most recent call last):
  File "gitinspector.py", line 194, in <module>
    main()
  File "gitinspector.py", line 182, in main
    __run__.output()
  File "gitinspector.py", line 73, in output
    outputable.output(changes.ChangesOutput(self.hard))
  File "/Users/niklasosterlund/Dropbox/public repos/gitinspector/gitinspector/outputable.py", line 38, in output
    outputable.output_text()
  File "/Users/niklasosterlund/Dropbox/public repos/gitinspector/gitinspector/changes.py", line 289, in output_text
    print(terminal.ljust(i, 20)[0:20 - terminal.get_excess_column_count(i)], end=" ")
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 7: 
ordinal not in range(128)

What version of the product are you using? What version of Python? On what
operating system?
latest from git repository, on yosemite

Please provide any additional information below.
fixed it by adding '.encode('ascii', 'ignore')' in terminal.py, like so:
def ljust(string, pad):
    return string.ljust(pad - get_excess_column_count(string)).encode('ascii', 'ignore')

def rjust(string, pad):
    return string.rjust(pad - get_excess_column_count(string)).encode('ascii', 'ignore')

If submitting a patch, you guarantee that you are the original author of
the work or that the patch is based on code from a compatible license.

Original issue reported on code.google.com by niklas.o...@gmail.com on 26 Dec 2014 at 9:47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants