From 8cc89fdfe58175f284e7fffafa16377a5547ac1b Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 6 Feb 2013 17:24:35 +0100 Subject: [PATCH] Avoid UnicodeEncodeError exception on exception When an exception message contained a non-ascii character, the str() conversion raised an UnicodeEncodeError. Avoid this by simply passing the message itself. Python handles the encoding to locale already. Change-Id: I3c4440fc238d8c8136a9bd93a0040668f82bda6e --- cinderclient/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cinderclient/shell.py b/cinderclient/shell.py index 1f174db80..423db58a3 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -489,7 +489,7 @@ def main(): except Exception, e: logger.debug(e, exc_info=1) - print >> sys.stderr, "ERROR: %s" % str(e) + print >> sys.stderr, "ERROR: %s" % e.message sys.exit(1)