Skip to content

Commit

Permalink
removes explicit decoding of arguments
Browse files Browse the repository at this point in the history
the elements of argv are already str objects which are already considered decoded by python 3.5.2. This commit adds a try-except block for the AttributeError that is raised. This should keep the decoding intact for python2 while silently dropping the error in python3

fixes sharat87#32
  • Loading branch information
fengor authored Dec 13, 2017
1 parent daa507a commit 214bbcc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/ti
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ def helpful_exit(msg=__doc__):
def parse_args(argv=sys.argv):
global use_color

argv = [arg.decode('utf-8') for arg in argv]
try:
argv = [arg.decode('utf-8') for arg in argv]
except AttributeError:
pass

if '--no-color' in argv:
use_color = False
Expand Down

0 comments on commit 214bbcc

Please sign in to comment.