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

git gud levels breaks on Windows #338

Open
sahansk2 opened this issue Jan 30, 2021 · 1 comment
Open

git gud levels breaks on Windows #338

sahansk2 opened this issue Jan 30, 2021 · 1 comment

Comments

@sahansk2
Copy link
Contributor

Sahan Kumarasinghe@DESKTOP-NTS61AN MINGW64 ~/my-git-gud (master)
$ git gud levels
Traceback (most recent call last):
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Sahan Kumarasinghe\AppData\Local\Programs\Python\Python39\Scripts\git-gud.exe\__main__.py", line 7, in <module>
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\site-packages\gitgud\__main__.py", line 530, in main
    GitGud().parse()
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\site-packages\gitgud\__main__.py", line 524, in parse
    self.command_dict[args.command](args)
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\site-packages\gitgud\__main__.py", line 378, in handle_levels
    show_skill_tree(
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\site-packages\gitgud\user_messages\__init__.py", line 202, in show_skill_tree
    display_entry(
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\site-packages\gitgud\user_messages\__init__.py", line 170, in display_entry
    print(indent + format_string.format(
  File "c:\users\sahan kumarasinghe\appdata\local\programs\python\python39\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-2: character maps to <undefined>
Levels in the current skill "intro" :

0. Introduction (intro)

This breaks on Git Gud versions 0.3.1 and 0.4.0. Just installed git gud and git bash. Looks like it's got something to do with the elbow characters. I'll open a PR soon for a quick fix.

@sahansk2
Copy link
Contributor Author

I redact my statement. It's got something to do with how Python interacts with Git Bash's console. A quick fix would be to use winpty and add an alias to the ~/.bashrc:

echo "alias git-gud='winpty git gud'" >> ~/.bashrc

I won't open a PR for this, since it's not only git gud levels that's broken, but also any Git command called by Git Gud that needs color. That, and a bunch of other random stuff. This whole situation actually might also explain #44 as well.

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

No branches or pull requests

1 participant