cityjson / cjio

CityJSON/io: Python CLI to process and manipulate CityJSON files
MIT License
125 stars 32 forks source link

encoding error when using cjio info command #169

Closed collaer closed 1 year ago

collaer commented 1 year ago

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):

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 commented 1 year ago

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 commented 1 year ago

wow, thanks for the reactivity