File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python3
22
3+ import sys
34import errno
45import struct
56import json
1213from threading import Timer , Lock
1314import time
1415
16+ python2 = sys .version_info [0 ] < 3
17+
1518
1619class MessageType (Enum ):
1720 COMMAND = 0
@@ -471,10 +474,15 @@ def _wait_for_socket(self):
471474 return socket_path_exists
472475
473476 def message (self , message_type , payload ):
477+ if python2 :
478+ ErrorType = IOError
479+ else :
480+ ErrorType = ConnectionError
481+
474482 try :
475483 self .cmd_lock .acquire ()
476484 return self ._ipc_send (self .cmd_socket , message_type , payload )
477- except BrokenPipeError as e :
485+ except ErrorType as e :
478486 if not self .auto_reconnect :
479487 raise (e )
480488
Original file line number Diff line number Diff line change 11from ipctest import IpcTest
22import i3ipc
3-
3+ import io
44
55class TestGetConfig (IpcTest ):
66 def test_get_config (self , i3 ):
77 config = i3 .get_config ()
88 assert isinstance (config , i3ipc .ConfigReply )
9- with open ('test/i3.config' ) as f :
9+ with io . open ('test/i3.config' , 'r' , encoding = 'utf-8 ' ) as f :
1010 assert config .config == f .read ()
Original file line number Diff line number Diff line change 1+ # coding=utf-8
2+ from __future__ import unicode_literals
3+
14from ipctest import IpcTest
25import i3ipc
36
You can’t perform that action at this time.
0 commit comments