[SWDEV-464799] Handle UnicodeEncodeError with non UTF-8 locales
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Change-Id: Ifb8e6e3c7891c4f70faba5441fb87cc4ba2302f3
[ROCm/rocm_smi_lib commit: c2235eea35]
이 커밋은 다음에 포함됨:
1 부모
0d5c46fe52
커밋
1998b57059
1 파일이 변경됨
+7
-1
@@ -871,7 +871,13 @@ def printLog(device, metricName, value=None, extraSpace=False, useItalics=False)
|
||||
try:
|
||||
if extraSpace:
|
||||
print('\n', end='')
|
||||
print(logstr + '\n', end='')
|
||||
|
||||
# Handle non UTF-8 locale
|
||||
try:
|
||||
print(logstr + '\n', end='')
|
||||
except UnicodeEncodeError:
|
||||
print(logstr.encode('ascii', 'ignore').decode('ascii'))
|
||||
|
||||
sys.stdout.flush()
|
||||
# when piped into programs like 'head' - print throws an error.
|
||||
# silently ignore instead
|
||||
|
||||
새 이슈에서 참조
사용자 차단