Skip to content

Commit

Permalink
Caught other error related to UnicodeEncodeError in colors.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
muammar committed Aug 14, 2016
1 parent 0754ffa commit 475b019
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mkchromecast/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def color(text, **user_styles):
raise KeyError('def color: parameter `{}` does not exist'.format(style))

color_text += text
return '\033[0m{}\033[0m'.format(color_text)
try:
return '\033[0m{}\033[0m'.format(color_text)
except UnicodeEncodeError:
return '\033[0m{}\033[0m'.format(unicode(color_text).encode("utf-8"))

def error(text):
return color(text, bold=True, fg_red=True)
Expand Down

0 comments on commit 475b019

Please sign in to comment.