UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 195: ordinal not in range(128)

ambari在重启knox时,报错:

File "/usr/lib/ambari-agent/lib/resource_management/core/logger.py", line 105, in filter_text
    text = text.replace(unprotected_string, protected_string)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 195: ordinal not in range(128)

错误原因,ambari的 脚本没有识中文,需要修改识别utf-8:
解决:vi /usr/lib/ambari-agent/lib/resource_management/core/logger.py
在 import 后添加
import sys  
reload(sys)
sys.setdefaultencoding('utf8')

 

 

你可能感兴趣的:(UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 195: ordinal not in range(128))