Encode error messages before sending them to stdout

When an error with non-ascii characters is caught by glanceclient, it
fails at printing it and exists with a UnicodeEncodedError. This patch
encodes errors' messages using strutils before sending them to stdout.

Fixes bug: #1200206

Change-Id: I4dabcd76ffb258840bd6a66ad23c030f34960e86
This commit is contained in:
Flaper Fesp
2013-07-11 15:28:49 +02:00
parent 8d7411d78b
commit fd0e117579
3 changed files with 28 additions and 1 deletions
+1 -1
View File
@@ -472,5 +472,5 @@ def main():
print >> sys.stderr, '... terminating glance client'
sys.exit(1)
except Exception as e:
print >> sys.stderr, e
print >> sys.stderr, utils.exception_to_str(e)
sys.exit(1)