ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.34k stars 324 forks source link

--version crashes (Windows 10, installed with npm) #212

Closed fuhrmanator closed 3 years ago

fuhrmanator commented 3 years ago

On Windows 10, in either WSL or git bash, with gitinspector installed in npm, the following command crashes:

gitinspector --version

Traceback (most recent call last):
  File "C:\Users\BLAH\AppData\Roaming\npm/node_modules/gitinspector/gitinspector.py", line 24, in <module>
    gitinspector.main()
  File "C:\Users\BLAH\AppData\Roaming\npm\node_modules\gitinspector\gitinspector\gitinspector.py", line 178, in main
    version.output()
  File "C:\Users\BLAH\AppData\Roaming\npm\node_modules\gitinspector\gitinspector\version.py", line 34, in output
    print("gitinspector {0}\n".format(__version__) + __doc__)
 File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
 UnicodeEncodeError: 'charmap' codec can't encode character u'\xa9' in position 32: character maps to <undefined>
adam-waldenberg commented 3 years ago

@fuhrmanator Your shell is incorrectly set up, so python is unable to output the character \xa9. You need to set your terminal to an encoding that can handle the character. Right now it's unable to show it - hence the error you get with the mapping to undefined.

fuhrmanator commented 3 years ago

Thanks! Here is the solution for me:

export PYTHONIOENCODING=UTF-8

https://github.com/pyupio/safety/issues/119#issuecomment-552320680