{"record":{"id":"220fbd04b0ecbd31","repo":"deepfakes/faceswap","slug":"no-display-detected-gui-mode-has-been-disabled","errorCode":null,"errorMessage":"No display detected. GUI mode has been disabled.","messagePattern":"No display detected\\. GUI mode has been disabled\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"lib/cli/launcher.py","lineNumber":169,"sourceCode":"            logger.info(\"Fedora: sudo dnf install python3-tkinter\")\n            raise FaceswapError(\"TkInter not found\") from err\n\n    @classmethod\n    def _check_display(cls) -> None:\n        \"\"\"Check whether there is a display to output the GUI to.\n\n        If running on Windows then it is assumed that we are not running in headless mode\n\n        Raises\n        ------\n        FaceswapError\n            If a DISPLAY environmental variable cannot be found\n        \"\"\"\n        if not os.environ.get(\"DISPLAY\", None) and os.name != \"nt\":\n            if platform.system() == \"Darwin\":\n                logger.info(\"macOS users need to install XQuartz. \"\n                            \"See https://support.apple.com/en-gb/HT201341\")\n            raise FaceswapError(\"No display detected. GUI mode has been disabled.\")\n\n    def execute_script(self, arguments: argparse.Namespace) -> None:\n        \"\"\"Performs final set up and launches the requested :attr:`_command` with the given\n        command line arguments.\n\n        Monitors for errors and attempts to shut down the process cleanly on exit.\n\n        Parameters\n        ----------\n        arguments\n            The command line arguments to be passed to the executing script.\n        \"\"\"\n        is_gui = hasattr(arguments, \"redirect_gui\") and arguments.redirect_gui\n        log_setup(arguments.loglevel, arguments.logfile, self._command, is_gui)\n        success = False\n\n        if self._command != \"gui\":\n            self._configure_backend(arguments)","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/lib/cli/launcher.py#L151-L187","documentation":"lib/config/ini.py resolves plugin config locations: if an explicit ini_path argument is given it must point to an existing file, otherwise ValueError. This guards typos before ConfigParser tries to read it.","triggerScenarios":"Constructing the ini Config object (or calling its path resolver) with ini_path='/path/that/does/not/exist.ini'; passing a directory instead of a file; relative paths resolved against an unexpected cwd; stale path after a file was moved/deleted.","commonSituations":"Pointing a plugin at a custom config file that was never created; scripts passing os.path.dirname instead of the file itself; the config file deleted after a cleanup or not restored from backup.","solutions":["Check the path with os.path.isfile before passing it, and fix the typo/missing file","Create the file first (copy the default from <repo>/config/<plugin_group>.ini or let the tool generate one by omitting ini_path)","If you meant the default location, pass ini_path=None instead of a bad path"],"exampleFix":"# before\ncfg = FaceswapConfig(ini_path=\"config/my_plugin.ini\")  # file absent -> ValueError\n\n# after\nimport os\nini = \"config/my_plugin.ini\"\nif not os.path.isfile(ini):\n    shutil.copy(\"config/.faceswap.example\", ini)\ncfg = FaceswapConfig(ini_path=ini)","handlingStrategy":"validation","validationCode":"import os\n\ndef display_available():\n    return os.name == \"nt\" or bool(os.environ.get(\"DISPLAY\"))\n\nassert display_available(), \"headless: use CLI subcommands or ssh -X\"","typeGuard":"def can_open_gui() -> bool:\n    \"\"\"True on Windows or when a DISPLAY/X server is configured.\"\"\"\n    import os\n    return os.name == \"nt\" or bool(os.environ.get(\"DISPLAY\"))","tryCatchPattern":"from lib.utils import FaceswapError\ntry:\n    launch_gui(args)\nexcept FaceswapError as err:\n    if \"No display detected\" in str(err):\n        switch_to_cli_mode(args)\n    else:\n        raise","preventionTips":["Use `ssh -X` or set DISPLAY for remote GUI sessions","Mount an X server (or skip GUI) in Docker containers","Default automation to extract/train/convert CLI commands"],"tags":["faceswap","config","ini","file-not-found","validation"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}