Merge pull request #85 from while0pass/master

fix UnicodeEncodeError
This commit is contained in:
Johann Dreo 2018-02-26 15:50:28 +01:00 committed by GitHub
commit e9f0bff0cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -698,6 +698,8 @@ def write(colored, stream = sys.stdout):
"""
Write "colored" on sys.stdout, then flush.
"""
if isinstance(colored, unicode):
colored = colored.encode('utf-8')
try:
stream.write(colored)
stream.flush()