From aeb55c5a3e0d05b1a9e3e5da7b99ac2524fd43e5 Mon Sep 17 00:00:00 2001 From: Adam Waldenberg Date: Wed, 10 Jul 2013 16:45:12 +0200 Subject: [PATCH] Fixed a potential encoding issue when printing exception messages. --- gitinspector/gitinspector.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gitinspector/gitinspector.py b/gitinspector/gitinspector.py index 378b339..21e65c8 100755 --- a/gitinspector/gitinspector.py +++ b/gitinspector/gitinspector.py @@ -21,6 +21,13 @@ from __future__ import print_function from __future__ import unicode_literals +#Small fix for Python 3 +try: + unicode +except NameError: + def unicode(string): + return str(string) + import localization localization.init() @@ -160,7 +167,7 @@ def main(): localization.enable() print(sys.argv[0], "\b:", end=" ") - print(msg) + print(unicode(msg)) print(_("Try `{0} --help' for more information.").format(sys.argv[0])) sys.exit(2)