jorgebastida / awslogs

AWS CloudWatch logs for Humans™

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled exception: UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 231: ordinal not in range(128)

cmaftuleac opened this issue · comments

When some logs contains invalid characters awslogs fails.
This is the traceback:

Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.5/site-packages/awslogs/bin.py", line 179, in main
getattr(logs, options.func)()
File "/home/ubuntu/.local/lib/python3.5/site-packages/awslogs/core.py", line 229, in list_logs
consumer()
File "/home/ubuntu/.local/lib/python3.5/site-packages/awslogs/core.py", line 218, in consumer
print(' '.join(output))
UnicodeEncodeError: 'ascii' codec can't encode character '\u2018' in position 231: ordinal not in range(128)

Getting same error, here's the traceback:

Version:       0.15.0
Python:        3.12.2 (main, Feb  7 2024, 20:47:03) [GCC 13.2.0]
boto3 version: 1.34.77
Platform:      Linux-5.15.133.1-microsoft-standard-WSL2-x86_64-with-glibc2.39
Args:          ['/home/kurtmisc/.local/bin/awslogs', 'get', '/ecs/stg-stg-ld-idp-backend', 'ecs/ld-idp-backend/2e09307e70b44b2ab425e9bbd5c820eb', '-s', '2h']
Config: {options}

Traceback (most recent call last):
  File "/home/kurtmisc/.local/lib/python3.12/site-packages/awslogs/bin.py", line 210, in main
    getattr(logs, options.func)()
  File "/home/kurtmisc/.local/lib/python3.12/site-packages/awslogs/core.py", line 219, in list_logs
    consumer()
  File "/home/kurtmisc/.local/lib/python3.12/site-packages/awslogs/core.py", line 206, in consumer
    print(" ".join(output))
UnicodeEncodeError: 'latin-1' codec can't encode character '\u258f' in position 194: ordinal not in range(256)