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

Unicode error with command line results (colorama) #3

Closed
VinceCabs opened this issue Sep 6, 2021 · 3 comments
Closed

Unicode error with command line results (colorama) #3

VinceCabs opened this issue Sep 6, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@VinceCabs
Copy link
Owner

VinceCabs commented Sep 6, 2021

For some reason, some unicode characters are undefined in Gitbash in some cases

Using existing tests in repo :

  • this seems OK :

    $ ga check tests/test_cli_mock.har home_engie -t tests/tracking_plan.json
    events in tracking plan: 3
    --------------------------------------------------------------------------------
    GA events found: total:4 / ok:3 / missing:0
    ✔ OK: all expected events found
  • this is not OK :

    (we only print stderr here)

    $ ga check tests/test_cli_mock.har home_engie -t tests/tracking_plan.json > output.txt
    Traceback (most recent call last):
      File "C:\Users\MD1116\Dev\Github_VinceCabs\ga-unit\.venv\Scripts\ga-script.py", line 33, in <module>
        sys.exit(load_entry_point('gaunit', 'console_scripts', 'ga')())
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\click\core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\click\core.py", line 782, in main
        rv = self.invoke(ctx)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\click\core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\click\core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\click\core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\gaunit\cli.py", line 63, in check
        r.print_result(display_ok=all)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\gaunit\models.py", line 483, in print_result
        self._print_summary()
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\gaunit\models.py", line 548, in _print_summary
        print("\N{Heavy Check Mark} OK: all expected events found")
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\colorama\ansitowin32.py", line 41, in write
        self.__convertor.write(text)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\colorama\ansitowin32.py", line 162, in write
        self.write_and_convert(text)
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\colorama\ansitowin32.py", line 190, in write_and_convert
        self.write_plain_text(text, cursor, len(text))
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
        self.wrapped.write(text[start:end])
      File "c:\users\md1116\dev\github_vincecabs\ga-unit\.venv\lib\encodings\cp1252.py", line 19, in encode
        return codecs.charmap_encode(input,self.errors,encoding_table)[0]
    UnicodeEncodeError: 'charmap' codec can't encode character '\u2714' in position 0: character maps to <undefined>```
    
@VinceCabs VinceCabs added the bug Something isn't working label Sep 6, 2021
@VinceCabs
Copy link
Owner Author

TODO : test if the bug does not come from colorama : https://github.com/tartley/colorama and submit issue if so.
@tartley FYI

@VinceCabs
Copy link
Owner Author

sumitted issue in colorama project
tartley/colorama#319

@VinceCabs
Copy link
Owner Author

VinceCabs commented Sep 6, 2021

workaround added in this release https://github.com/VinceCabs/GAUnit/releases/tag/v0.5.4
Thanks @mara004

VinceCabs added a commit that referenced this issue Sep 6, 2021
@VinceCabs VinceCabs reopened this Sep 6, 2021
@VinceCabs VinceCabs changed the title Unicode error with command line results Unicode error with command line results (colorama) Sep 6, 2021
VinceCabs added a commit that referenced this issue Sep 15, 2021
provide real fix with alternative text without special character (#3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant