From fbfb9c966f79c0ee873644edb230674795ff8a90 Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Mon, 21 Nov 2016 21:35:56 +0200 Subject: [PATCH] Write nice messages about connection status --- pupy/pupylib/PupyServer.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pupy/pupylib/PupyServer.py b/pupy/pupylib/PupyServer.py index 3b5a3f03..cf71c2d5 100644 --- a/pupy/pupylib/PupyServer.py +++ b/pupy/pupylib/PupyServer.py @@ -35,6 +35,7 @@ import marshal import network.conf import rpyc import shlex +import socket try: import ConfigParser as configparser @@ -270,8 +271,14 @@ class PupyServer(threading.Thread): except LauncherError as e: launcher.arg_parser.print_usage() return - stream=launcher.iterate().next() - self.handler.display_info("Connecting ...") + + try: + stream=launcher.iterate().next() + except socket.error as e: + self.handler.display_error("Couldn't connect to pupy: {}".format(e)) + return + + self.handler.display_success("Connected. Starting session") bgsrv=PupyConnectionThread(PupyService.PupyBindService, rpyc.Channel(stream), config={}) bgsrv.start()