def __init__(self, options): AsyncClient.__init__(self) try: self.connect(options.host, options.port) except socket_error, err: writeError(err, "Connection error") exit(1)
def __init__(self): AsyncClient.__init__(self) try: self.connect(HOST, PORT) except socket_error, err: writeError(err, "Connection error") exit(1)
def showtraceback(self): info = exc_info() errtype, err, tb = info if isinstance(err, KeyboardInterrupt): self.logger.error("Keyboard interrupt.") else: writeError(err, "Error", logger=self.logger, traceback=info)
def createInterpreter(self): sys.ps1 = PROMPT1 sys.ps2 = PROMPT2 readline.parse_and_bind("tab: complete") commands = self.client.getCommands() locals = dict((command.__name__, command) for command in commands) locals['pyhelp'] = help try: proxies = self.client.createProxies(locals) except Exception, err: writeError(err, "Error on getting the component list", logger=self.logger) proxies = None
def writeError(self, error, *args, **options): options['logger'] = self writeError(error, *args, **options)