colorama - H2O cluster show status charmap error -
when trying print out cluster show status of h2o cluster on windows computers, gives following error:
h2o.init(nthreads = -1, strict_version_check = false)
file "c:\python27\lib\site-packages\h2o\h2o.py", line 267, in init h2oconn.cluster.show_status()
file "c:\python27\lib\site-packages\h2o\backend\cluster.py", line 237, in show_status
["python version:", "%d.%d.%d %s" % tuple(sys.version_info[:4])], file "c:\python27\lib\site-packages\h2o\display.py", line 49, in init self.pprint()
file "c:\python27\lib\site-packages\h2o\display.py", line 59, in pprint print(r)
file "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 40, in write self.__convertor.write(text)
file "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 141, in write self.write_and_convert(text)
file "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 169, in write_and_convert self.write_plain_text(text, cursor, len(text))
file "c:\python27\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text self.wrapped.write(text[start:end]) file "c:\python27\lib\encodings\cp857.py", line 12, in encode return codecs.charmap_encode(input,errors,encoding_map)
unicodeencodeerror: 'charmap' codec can't encode character u'\u2021' in position 210: character maps h2o session _sid_a367 closed.
it seems colorama python library can not handle different locale/charsets outputs on windows terminals.
a workaround problem set below environment variable before running python script:
set pythonioencoding=utf-8
Comments
Post a Comment