replaced e.message

BaseException.message has been deprecated as of Python 2.6.

http://legacy.python.org/dev/peps/pep-0352/

Replaced e.message with six.text_type(e) (uses unicode with
Python 2.x and str with Python 3.x).

Change-Id: I89aa278c337dd5985d6de28563b1d6e64ce4f95a
This commit is contained in:
Christian Berendt 2014-05-14 19:18:40 +02:00
parent d67a087082
commit 222272850a
1 changed files with 3 additions and 1 deletions

View File

@ -21,6 +21,8 @@ import logging
import logging.handlers
import sys
import six
from tuskarclient import client
import tuskarclient.common.utils as utils
from tuskarclient.openstack.common.apiclient import exceptions as exc
@ -223,7 +225,7 @@ def main():
try:
TuskarShell(sys.argv[1:]).run()
except exc.CommandError as e:
print(e.message, file=sys.stderr)
print(six.text_type(e), file=sys.stderr)
except Exception as e:
logger.exception("Exiting due to an error:")
sys.exit(1)