【问题标题】:H2O cluster show status charmap errorH2O 集群显示状态charmap 错误
【发布时间】:2017-08-18 05:43:40
【问题描述】:

在 Windows 计算机上尝试打印 H2O 集群的集群显示状态时,出现以下错误:

h2o.init(nthreads = -1, strict_version_check = False)

文件“c:\python27\lib\site-packages\h2o\h2o.py”,第 267 行,在 init h2oconn.cluster.show_status()

文件“c:\python27\lib\site-packages\h2o\backend\cluster.py”,第 237 行,在 show_status 中

["Python 版本:", "%d.%d.%d %s" % tuple(sys.version_info[:4])], init 中的文件“c:\python27\lib\site-packages\h2o\display.py”,第 49 行 self.pprint()

文件“c:\python27\lib\site-packages\h2o\display.py”,第 59 行,在 pprint 中 打印(r)

文件“c:\python27\lib\site-packages\colorama\ansitowin32.py”,第 40 行,写入 self.__convertor.write(文本)

文件“c:\python27\lib\site-packages\colorama\ansitowin32.py”,第 141 行,写入 self.write_and_convert(text)

文件“c:\python27\lib\site-packages\colorama\ansitowin32.py”,第 169 行,在 write_and_convert self.write_plain_text(text, cursor, len(text))

文件“c:\python27\lib\site-packages\colorama\ansitowin32.py”,第 174 行,在 write_plain_text self.wrapped.write(文本[开始:结束]) 文件“C:\Python27\lib\encodings\cp857.py”,第 12 行,在编码中 返回 codecs.charmap_encode(input,errors,encoding_map)

UnicodeEncodeError: 'charmap' codec can't encode character u'\u2021' in position 210: character maps to H2O 会话_sid_a367 已关闭。

colorama Python 库似乎无法在 Windows 终端上处理不同的语言环境/字符集输出。

【问题讨论】:

    标签: h2o colorama


    【解决方案1】:

    解决此问题的方法是在运行 Python 脚本之前设置以下环境变量:

    设置 PYTHONIOENCODING=UTF-8

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-09
      • 1970-01-01
      • 2016-06-23
      • 1970-01-01
      • 2016-06-22
      • 1970-01-01
      相关资源
      最近更新 更多