unimport icon indicating copy to clipboard operation
unimport copied to clipboard

Emoji in print causes an exception on non utf terminals

Open tolomea opened this issue 4 years ago • 3 comments
trafficstars

This line https://github.com/unimport/unimport/blob/27f421d5f83dee28d7c996db76573ffef8e782cf/unimport/main.py#L196 lead to this error:

Traceback (most recent call last):
  File "C:\redacted\Scripts\unimport-script.py", line 33, in <module>
    sys.exit(load_entry_point('unimport==0.7.4', 'console_scripts', 'unimport')())
  File "c:\redacted\lib\site-packages\unimport\main.py", line 194, in main
    print(
  File "C:\redacted\Python38\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 '\u2728' in position 0: character maps to <undefined>

tolomea avatar Mar 01 '21 15:03 tolomea

I intend to remove these emojis, and maybe even colours. Since they are too problematic for CLI applications. What do you think @hakancelik96?

isidentical avatar Mar 02 '21 17:03 isidentical

I intend to remove these emojis, and maybe even colors. Since they are too problematic for CLI applications. What do you think @hakancelik96?

I think we may remove it, they seem to be causing more problems than problem-solving.

hakancelikdev avatar Mar 05 '21 07:03 hakancelikdev

Hi @tolomea, I worked a little on this issue but I was not sure the issue was solved, can you install it on your system with the master branch and try again, if you get the same error please let me know what caused it.

hakancelikdev avatar May 08 '21 15:05 hakancelikdev