def main(): try: argv = [strutils.safe_decode(a) for a in sys.argv[1:]] OpenStackComputeShell().main(argv) except Exception as e: logger.debug(e, exc_info=1) details = {'name': strutils.safe_encode(e.__class__.__name__), 'msg': strutils.safe_encode(six.text_type(e))} print("ERROR (%(name)s): %(msg)s" % details, file=sys.stderr) sys.exit(1) except KeyboardInterrupt as e: print("Shutting down novaclient", file=sys.stderr) sys.exit(1)
def loads(s, encoding='utf-8'): return json.loads(strutils.safe_decode(s, encoding))