From 4de105682e5b2f5c9bc7c7701a58a050918d642c Mon Sep 17 00:00:00 2001 From: Abhilash Raj Date: Sat, 5 Jun 2021 10:51:59 -0700 Subject: [PATCH] Fix testproto. --- qweechat/weechat/testproto.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/qweechat/weechat/testproto.py b/qweechat/weechat/testproto.py index 54cd2c8..76a7aed 100644 --- a/qweechat/weechat/testproto.py +++ b/qweechat/weechat/testproto.py @@ -34,9 +34,9 @@ import sys import time import traceback -import protocol # WeeChat/relay protocol -# from .. version import qweechat_version -qweechat_version = '1.1' +from qweechat.weechat import protocol + +qweechat_version = '0.1' NAME = 'qweechat-testproto' @@ -60,12 +60,13 @@ class TestProto(object): try: self.sock = socket.socket(inet, socket.SOCK_STREAM) self.sock.connect((self.args.hostname, self.args.port)) - except: # noqa: E722 + except Exception: if self.sock: self.sock.close() print('Failed to connect to', self.address) return False - print('Connected to', self.address) + + print(f'Connected to {self.address} socket {self.sock}') return True def send(self, messages): @@ -122,7 +123,7 @@ class TestProto(object): data = os.read(sys.stdin.fileno(), 4096) if data: if not self.send(data.strip()): - # self.sock.close() + self.sock.close() return False # open stdin to read user commands sys.stdin = open('/dev/tty')