def __init__(self, msg=None): if platform.python_version().startswith('3'): super().__init__(msg) if platform.python_version().startswith('2'): super(IxNetRestApiException, self). __init__(msg) if Connect.robotStdout is not None: Connect.robotStdout.log_to_console(msg) showErrorMsg = '\nIxNetRestApiException error: {0}\n\n'.format(msg) print(showErrorMsg) if Connect.enableDebugLogFile: with open(Connect.debugLogFile, 'a') as restLogFile: restLogFile.write(showErrorMsg) class Connect: # For IxNetRestApiException debugLogFile = None enableDebugLogFile = False robotStdout = None