Skip to content

Commit

Permalink
fix win console encoding error
Browse files Browse the repository at this point in the history
  • Loading branch information
titusz committed Jul 15, 2016
1 parent 7ba52a5 commit 10f7061
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def read(*names, **kwargs):
if sys.version.startswith('2.6'):
dependencies.append('argparse')


if sys.platform == 'win32':
dependencies.append('win-unicode-console')


setup(
name='onixcheck',
version='0.9.3',
Expand Down
13 changes: 10 additions & 3 deletions src/onixcheck/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ def main(argv=None):
)
print('DEBUG logging enabled.')

try:
import win_unicode_console
win_unicode_console.enable()
log.debug('Running with win-unicode-console patch')
except Exception:
pass

log.debug('TYPE of path: %s' % type(args.path))
# validate current working dir
if not args.infile and not args.path:
Expand All @@ -75,7 +82,7 @@ def main(argv=None):
all_valid = False
for msg in messages:
if args.debug:
print(msg, file=sys.stderr)
print(msg.__str__(), file=sys.stderr)
else:
print(msg.short, file=sys.stderr)

Expand All @@ -98,9 +105,9 @@ def main(argv=None):
all_valid = False
for msg in messages:
if args.debug:
print(msg.short, file=sys.stderr)
print(msg.__str__(), file=sys.stderr)
else:
print(msg, file=sys.stderr)
print(msg.short, file=sys.stderr)
if all_valid:
return 0
else:
Expand Down

0 comments on commit 10f7061

Please sign in to comment.