From 69fa91b4322395b125b8e50821ad88d0e0d2a313 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 4 Aug 2013 16:12:23 +0200 Subject: Fix python 3.x related Hacking warnings Convert print operator usages to print functions. Fix one instance of outdated "except x,y:" syntactical construct. Remove usages of local() in string formatting alongway. Change-Id: Id0673a9183a6ea6bd9bf3f5c6d8e7c5f114ebf01 --- glanceclient/common/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'glanceclient/common/utils.py') diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 88f7621..cd4a9c9 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -13,6 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. +from __future__ import print_function + import errno import os import sys @@ -54,14 +56,14 @@ def print_list(objs, fields, formatters={}): row.append(data) pt.add_row(row) - print strutils.safe_encode(pt.get_string()) + print(strutils.safe_encode(pt.get_string())) def print_dict(d): pt = prettytable.PrettyTable(['Property', 'Value'], caching=False) pt.align = 'l' [pt.add_row(list(r)) for r in d.iteritems()] - print strutils.safe_encode(pt.get_string(sortby='Property')) + print(strutils.safe_encode(pt.get_string(sortby='Property'))) def find_resource(manager, name_or_id): @@ -137,7 +139,7 @@ def import_versioned_module(version, submodule=None): def exit(msg=''): if msg: - print >> sys.stderr, strutils.safe_encode(msg) + print(strutils.safe_encode(msg), file=sys.stderr) sys.exit(1) -- cgit v1.2.1