Skip to content

Commit

Permalink
fix #23: sys.stdout.encoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
xyb committed Aug 3, 2017
1 parent 88b96c0 commit 51d9d30
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion DebugLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,20 @@

KEYWORD_SEP = re.compile(' +|\t')

COMMAND_LINE_ENCODING = sys.stdout.encoding or 'utf-8'

def get_command_line_encoding():
encoding = ''
try:
encoding = sys.stdout.encoding
except AttributeError:
try:
encoding = sys.__stdout__.encoding
except Exception:
pass
return encoding or 'utf-8'


COMMAND_LINE_ENCODING = get_command_line_encoding()


class BaseCmd(cmd.Cmd):
Expand Down

0 comments on commit 51d9d30

Please sign in to comment.