def __init__(self, message, translate=True, print_stack=False, stack_frame=1): import eosfactory.core.setup as setup if setup.is_raise_error or print_stack: sys.tracebacklimit = 10 self.message = logger.error(message, translate) Exception.__init__(self, self.message) else: sys.excepthook = excepthook sys.tracebacklimit = 0 from inspect import getframeinfo, stack frameinfo = getframeinfo(stack()[stack_frame][0]) details = " {} {}".format(frameinfo.filename, frameinfo.lineno) self.message = logger.error(message, translate, details=details) Exception.__init__(self, self.message)
def wsl_root(): '''The root directory of the Windows WSL, or empty string if not Windows. The root directory of the Ubuntu file system, owned by the installation, if any, of the Windows Subsystem Linux (WSL). It may be changed with *WSL_ROOT* entry in the *config.json* file, see :func:`.current_config`. ''' if not utils.is_windows_ubuntu(): return "" wsl_root_sh = "wsl_root.sh" wsl_root_sh = os.path.join(eosfactory_data(), wsl_root_sh) if wsl_root_[1][0] is None: path = "" path, error = utils.spawn([wsl_root_sh, path], raise_exception=False) if error: while True: if not os.path.exists(wsl_root_sh): path = "" logger.ERROR(''' Cannot find the bash command: '{}' The intelisense feature of Visual Studio Code will be disabled. '''.format(wsl_root_sh), translate=False) break path = input( logger.error(''' Error message is {} Cannot find the root of the WSL file system which was tried to be '{}' Please, find the path in your computer and enter it. Enter nothing, if you do not care about having efficient the intelisense of Visual Studio Code. '''.format(error, path), translate=False) + "\n<<< ") if not path: break path, error = utils.spawn([wsl_root_sh, path], raise_exception=False) if not error: break path = path.replace("\\", "/") path = path.replace(path[0:2], path[0:2].lower()) wsl_root_[1][0] = path return wsl_root_[1][0]
def __init__(self, message, translate=True): self.message = logger.error(message, translate) Exception.__init__(self, self.message)