Fix the CLI in py3

This commit is contained in:
Eevee (Alex Munroe) 2015-10-05 16:29:21 -07:00
parent 17999c5b1a
commit 0ff24b4dc8
3 changed files with 22 additions and 13 deletions
pokedex

View file

@ -21,7 +21,7 @@ def main(*argv):
# XXX there must be a better way to get Unicode argv
# XXX this doesn't work on Windows durp
enc = sys.stdin.encoding or 'utf8'
args = [_.decode(enc) for _ in args]
args = [_.decode(enc) if isinstance(_, bytes) else _ for _ in args]
# Find the command as a function in this file
func = globals().get("command_%s" % command, None)