termgraph icon indicating copy to clipboard operation
termgraph copied to clipboard

UnicodeEncodeError: 'latin-1' codec can't encode character '\u2587' in position 0: ordinal not in range(256)

Open avimehenwal opened this issue 6 years ago • 3 comments

Screenshot_20191004_145451

Hey, I am facing following issue when trying too tun termgraph. Problem could be with my terminal setting but I am unsure how to debug it. Kindly help

Traceback (most recent call last):
  File "/home/avi/.local/bin/termgraph", line 10, in <module>
    sys.exit(main())
  File "/home/avi/.local/lib/python3.7/site-packages/termgraph/termgraph.py", line 151, in main
    chart(colors, data, args, labels)
  File "/home/avi/.local/lib/python3.7/site-packages/termgraph/termgraph.py", line 394, in chart
    print_row(*row)
  File "/home/avi/.local/lib/python3.7/site-packages/termgraph/termgraph.py", line 255, in print_row
    sys.stdout.write(TICK)
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2587' in position 0: ordinal not in range(256)

Environment details

Install via pip3 install termgraph. Running termgraph --help works fine

SHELL : fish, version 3.0.2

OS debian linux

Distributor ID: Parrot
Description:    Parrot GNU/Linux 4.7
Release:        4.7
Codename:       n/a

Expected

termgraph should run on linux shell without problem

Actual

termgraph throws error UnicodeEncodeError: 'latin-1' codec can't encode character '\u2587' in position 0: ordinal not in range(256)

Steps

  1. Install termgraph using pip3 tool
  2. Clone termgraph repo and cd to /data directory
  3. Try to run examples termgraph ex1.dat etc

avimehenwal avatar Oct 04 '19 13:10 avimehenwal

This may help: encode error

jgphpc avatar Jun 16 '20 08:06 jgphpc

I'm not quite sure the setup, either your font or terminal, but it looks like it is not using UTF-8.

mkaz avatar Jun 19 '20 14:06 mkaz

I noticed that the error does not happen with python>=3.7, maybe worth a try.

jgphpc avatar Jun 19 '20 15:06 jgphpc