ansiescapes icon indicating copy to clipboard operation
ansiescapes copied to clipboard

Exception on str decode & making it work in terminal

Open pholat opened this issue 6 years ago • 1 comments

https://github.com/kodie/ansiescapes/blob/25a4b90343349d70db02b2a35c29e3120b494b6f/ansiescapes.py#L8

I'm in no way python enthusiast but this line results in error:

  File "/home/pholat/.local/lib/python3.6/site-packages/ansiescapes.py", line 8, in _
    def _(s): return s.decode('unicode_escape');
AttributeError: 'str' object has no attribute 'decode'

So shouldn't it be decode? Also to actually use to manipulate terminal with sys.stdout.buffer.write imho ESC should be: \033[ although there is character [ added, while it's not a part of escape key :) as well as it shouldn't be ansii_escaped so that it would actually work.

pholat avatar Jan 26 '19 21:01 pholat

I am having the same problem.

jeffs@jeffs-desktop:/home/jeffs/python/ansiescapes/ansiescapes-master  (development) *  $ python3 ansiescapes.py 
Traceback (most recent call last):
  File "ansiescapes.py", line 53, in <module>
    cursorLeft = _(ESC + 'G');
  File "ansiescapes.py", line 8, in _
    def _(s): return s.decode('unicode_escape');
AttributeError: 'str' object has no attribute 'decode'
jeffs@jeffs-desktop:/home/jeffs/python/ansiescapes/ansiescapes-master  (development) *  $ 

I am a python enthusiast, so I am going to investigate a little bit and see if the forks have addressed this issue.

jeffsilverm avatar Dec 26 '19 00:12 jeffsilverm