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

encoding error when using cjio info command #169

Closed
collaer opened this issue Jul 12, 2023 · 2 comments
Closed

encoding error when using cjio info command #169

collaer opened this issue Jul 12, 2023 · 2 comments

Comments

@collaer
Copy link

collaer commented Jul 12, 2023

Describe the bug
encoding error when using cjio command info.
Did I installed it wrong or is it a windows issue?

Traceback (most recent call last):
  File "C:\x\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\x\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\x\Python310\Scripts\cjio.exe\__main__.py", line 7, in <module>
  File "C:\x\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\x\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\x\Python310\lib\site-packages\click\core.py", line 1689, in invoke
    return _process_result(rv)
  File "C:\x\Python310\lib\site-packages\click\core.py", line 1626, in _process_result
    value = ctx.invoke(self._result_callback, value, **ctx.params)
  File "C:\x\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\x\Python310\lib\site-packages\cjio\cjio.py", line 94, in process_pipeline
    cm = processor(cm)
  File "C:\x\Python310\lib\site-packages\cjio\cjio.py", line 102, in processor
    print_cmd_status('Information \u2b07\ufe0f')
  File "C:\x\Python310\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\x\Python310\lib\site-packages\cjio\cjio.py", line 756, in print_cmd_status
    _print_cmd(s, bg='cyan', fg='black')
  File "C:\x\Python310\lib\site-packages\cjio\cjio.py", line 735, in _print_cmd
    click.secho(s, **styles)
  File "C:\x\Python310\lib\site-packages\click\termui.py", line 637, in secho
    return echo(message, file=file, nl=nl, err=err, color=color)
  File "C:\x\Python310\lib\site-packages\click\utils.py", line 299, in echo
    file.write(out)  # type: ignore
  File "C:\x\Python310\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 12-13: character maps to <undefined>

cjio version
cjio v0.8.1; supports CityJSON v1.1
pip installed recently on Python 3.x

To Reproduce
cjio anyfile.city.json info

Expected behavior
info output

Desktop (please complete the following information):

  • OS: Windows 10
  • Version 10

Additional context
Looks like those chars are messing with my pip installed version on windows: https://github.com/cityjson/cjio/blob/master/cjio/cjio.py#L102

Again I will be happy to help once if it's confirmed that's a bug and how it should be fixed

@hugoledoux
Copy link
Member

hmmm, it's highly possible that your Windows console cannot handle those 2 emojis. I can't test myself (no easy access to a Windows machine) but it's better to remove them.

I'll do that in a second and release v0.8.2

@collaer
Copy link
Author

collaer commented Jul 20, 2023

wow, thanks for the reactivity

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

2 participants