mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-29 20:21:35 +03:00
Fix python 2.6 in client/server mode
This commit is contained in:
parent
b7bbd69a65
commit
2a2c893836
@ -114,7 +114,7 @@ def main():
|
|||||||
server = GlancesServer(cached_time=core.cached_time,
|
server = GlancesServer(cached_time=core.cached_time,
|
||||||
config=core.get_config(),
|
config=core.get_config(),
|
||||||
args=args)
|
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)
|
# Set the server login/password (if -P/--password tag)
|
||||||
if (args.password != ""):
|
if (args.password != ""):
|
||||||
|
@ -56,8 +56,8 @@ class GlancesClient():
|
|||||||
# Try to connect to the URI
|
# Try to connect to the URI
|
||||||
try:
|
try:
|
||||||
self.client = ServerProxy(uri)
|
self.client = ServerProxy(uri)
|
||||||
except Exception as e:
|
except Exception as err:
|
||||||
print("{} {} ({})".format(_("Error: creating client socket"), uri, e))
|
print(_("Error: Couldn't create socket {0}: {1}").format(uri, err))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
@ -67,13 +67,13 @@ class GlancesClient():
|
|||||||
try:
|
try:
|
||||||
client_version = self.client.init()
|
client_version = self.client.init()
|
||||||
except socket.error as err:
|
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)
|
sys.exit(2)
|
||||||
except ProtocolError as err:
|
except ProtocolError as err:
|
||||||
if (str(err).find(" 401 ") > 0):
|
if (str(err).find(" 401 ") > 0):
|
||||||
print("{} ({})".format(_("Error: Connection to server failed"), _("Bad password")))
|
print(_("Error: Connection to server failed: Bad password"))
|
||||||
else:
|
else:
|
||||||
print("{} ({})".format(_("Error: Connection to server failed"), err))
|
print(_("Error: Connection to server failed: {0}").format(err))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
# Test if client and server are "compatible"
|
# Test if client and server are "compatible"
|
||||||
@ -90,7 +90,7 @@ class GlancesClient():
|
|||||||
self.screen = glancesCurses(args=self.args)
|
self.screen = glancesCurses(args=self.args)
|
||||||
|
|
||||||
# Debug
|
# 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
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user