From 2a2c8938364938cbb0760614389d44b2820dd82a Mon Sep 17 00:00:00 2001 From: Alessio Sergi Date: Thu, 17 Apr 2014 18:32:59 +0200 Subject: [PATCH] Fix python 2.6 in client/server mode --- glances/__init__.py | 2 +- glances/core/glances_client.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/glances/__init__.py b/glances/__init__.py index 10b3d1a3..a9f0a189 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -114,7 +114,7 @@ def main(): server = GlancesServer(cached_time=core.cached_time, config=core.get_config(), args=args) - print("{} {}:{}".format(_("Glances server is running on"), args.bind, args.port)) + print(_("Glances server is running on {0}:{1}").format(args.bind, args.port)) # Set the server login/password (if -P/--password tag) if (args.password != ""): diff --git a/glances/core/glances_client.py b/glances/core/glances_client.py index 2bb04da2..55f8e189 100644 --- a/glances/core/glances_client.py +++ b/glances/core/glances_client.py @@ -56,8 +56,8 @@ class GlancesClient(): # Try to connect to the URI try: self.client = ServerProxy(uri) - except Exception as e: - print("{} {} ({})".format(_("Error: creating client socket"), uri, e)) + except Exception as err: + print(_("Error: Couldn't create socket {0}: {1}").format(uri, err)) sys.exit(2) def login(self): @@ -67,13 +67,13 @@ class GlancesClient(): try: client_version = self.client.init() except socket.error as err: - print("{} ({})".format(_("Error: Connection to server failed"), err)) + print(_("Error: Connection to server failed: {0}").format(err)) sys.exit(2) except ProtocolError as err: if (str(err).find(" 401 ") > 0): - print("{} ({})".format(_("Error: Connection to server failed"), _("Bad password"))) + print(_("Error: Connection to server failed: Bad password")) else: - print("{} ({})".format(_("Error: Connection to server failed"), err)) + print(_("Error: Connection to server failed: {0}").format(err)) sys.exit(2) # Test if client and server are "compatible" @@ -90,7 +90,7 @@ class GlancesClient(): self.screen = glancesCurses(args=self.args) # Debug - # print "Server version: {}\nClient version: {}\n".format(__version__, client_version) + # print "Server version: {0}\nClient version: {1}\n".format(__version__, client_version) return True else: return False