34 @param port port of the background service |
34 @param port port of the background service |
35 """ |
35 """ |
36 self.services = {} |
36 self.services = {} |
37 |
37 |
38 self.connection = socket.create_connection((host, port)) |
38 self.connection = socket.create_connection((host, port)) |
39 ver = b'2' if sys.version_info[0] == 2 else b'3' |
39 ver = b'Python2' if sys.version_info[0] == 2 else b'Python3' |
40 self.connection.sendall(ver) |
40 self.connection.sendall(ver) |
41 self.connection.settimeout(0.25) |
41 self.connection.settimeout(0.25) |
42 |
42 |
43 def __initClientService(self, fn, path, module): |
43 def __initClientService(self, fn, path, module): |
44 """ |
44 """ |
122 @param excval data about the exception |
122 @param excval data about the exception |
123 @param exctb traceback for the exception |
123 @param exctb traceback for the exception |
124 """ |
124 """ |
125 # TODO: Wrap arguments so they can be serialized by JSON |
125 # TODO: Wrap arguments so they can be serialized by JSON |
126 self.__send( |
126 self.__send( |
127 'exception', '?', [str(exctype), str(excval), str(exctb)]) |
127 'EXCEPTION', '?', [str(exctype), str(excval), str(exctb)]) |
128 |
128 |
129 if __name__ == '__main__': |
129 if __name__ == '__main__': |
130 if len(sys.argv) != 3: |
130 if len(sys.argv) != 3: |
131 print('Host and port parameters are missing. Abort.') |
131 print('Host and port parameters are missing. Abort.') |
132 sys.exit(1) |
132 sys.exit(1) |