Skip to content

Commit

Permalink
Update mitie.py adding try/pass to to_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
avitale authored Sep 20, 2016
1 parent 8892ee7 commit 2d760a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mitielib/mitie.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ def to_bytes(string):
"""Encode the string in utf-8. If the string is already encoded (bytes in Python 3
or str in Python 2), return the string unmodified."""
if hasattr(string, 'encode'):
string = string.encode('utf-8')
try:
temp = string.encode('utf-8')
string = temp
except:
pass

return string

Expand Down

0 comments on commit 2d760a7

Please sign in to comment.