From 5b33e919d98cb0b77c49f2860a3cc9a5c9a4de80 Mon Sep 17 00:00:00 2001 From: gou4shi1 Date: Mon, 15 May 2017 19:07:15 +0800 Subject: [PATCH] there is no _EXIT_ in socket in python2 --- plugin/fcitx.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/fcitx.py b/plugin/fcitx.py index 57cf94a..59d8159 100644 --- a/plugin/fcitx.py +++ b/plugin/fcitx.py @@ -4,6 +4,7 @@ import os import vim import socket import struct +import contextlib fcitxsocketfile = vim.eval('s:fcitxsocketfile') @@ -48,7 +49,7 @@ class FcitxComm(object): if not self._connect(): return - with self.sock: + with contextlib.closing(self.sock): try: return func(*args, **kwargs) except (socket.error, socket.timeout, struct.error) as e: