Fix python 2.6 in client/server mode

This commit is contained in:
Alessio Sergi 2014-04-17 18:32:59 +02:00
parent b7bbd69a65
commit 2a2c893836
2 changed files with 7 additions and 7 deletions

View File

@ -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 != ""):

View File

@ -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