From 4038b81a2239fd85b89f3d6124d01f02379ca475 Mon Sep 17 00:00:00 2001 From: thomasv Date: Mon, 22 Oct 2012 14:56:59 +0200 Subject: [PATCH] catch exception when client is disconnected --- lib/interface.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/interface.py b/lib/interface.py index 9e031426..d9be2902 100644 --- a/lib/interface.py +++ b/lib/interface.py @@ -295,8 +295,13 @@ class Interface(threading.Thread): self.message_id += 1 out += request + '\n' while out: - sent = self.s.send( out ) - out = out[sent:] + try: + sent = self.s.send( out ) + out = out[sent:] + except: + # this happens when we get disconnected + print "Not connected, cannot send" + return None return ids