ejwa / gitinspector

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

decode() argument 1 must be string, not None #168

Closed ghost closed 6 years ago

ghost commented 6 years ago

Getting this error when running from Jenkins Shell command

+ /usr/lib/node_modules/gitinspector/gitinspector.py <<Repository Path>>>
Traceback (most recent call last):
  File "/usr/lib/node_modules/gitinspector/gitinspector.py", line 24, in <module>
    gitinspector.main()
  File "/usr/lib/node_modules/gitinspector/gitinspector/gitinspector.py", line 131, in main
    argv = terminal.convert_command_line_to_utf8()
  File "/usr/lib/node_modules/gitinspector/gitinspector/terminal.py", line 122, in convert_command_line_to_utf8
    argv.append(arg.decode(sys.stdin.encoding, "replace"))
TypeError: decode() argument 1 must be string, not None
MichaelKaaden commented 6 years ago

@varun7447 Setting the environment variable PYTHONIOENCODING should fix your problem. Please give it a try!

ghost commented 6 years ago

What should be the encoding set to?

On Thu, Jan 25, 2018 at 11:47 PM Michael Kaaden notifications@github.com wrote:

@varun7447 https://github.com/varun7447 Setting the environment variable PYTHONIOENCODING should fix your problem. Please give it a try!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ejwa/gitinspector/issues/168#issuecomment-360707533, or mute the thread https://github.com/notifications/unsubscribe-auth/AEdRZL3w-EgppDt02-Tp0BkAbj0UUBMVks5tOYMHgaJpZM4Rqvxh .

MichaelKaaden commented 6 years ago

That depends. I like using UTF-8.

Art4 commented 6 years ago

I had the same issue. Using env PYTHONIOENCODING=utf-8 gitinspector.py ... works for me.

adam-waldenberg commented 6 years ago

This is an old issue, previously discussed. It is related to Python and invalid terminal encodings. See for example #19. Not a gitinspector issue.

Closing.

Art4 commented 6 years ago

I think it is worth to document this issue in the wiki.

adam-waldenberg commented 6 years ago

@Art4 It kinda already is mentioned in the FAQ. However it uses UnicodeEncodeError exception as an example, which is related. Same issue, but a different exception. It all comes down to a terminal that can't handle the characters.

In this instance it just happens earlier because sys.stdin.encoding is set to None.