          """ Build the faceswap command and arguments list.
  
          If training, pass the model folder and name to the training
          :class:`lib.gui.analysis.Session` for the GUI.
          """
          logger.debug("Build cli arguments: (category: %s, command: %s, generate: %s)",
                       category, command, generate)
          command = self._command if not command else command
 
</s> remove         command = self.command if not command else command
 </s> add         command = self._command if not command else command
        assert command is not None </s> remove     def build_args(self, category, command=None, generate=False):
 </s> add     def _build_args(self,
                    category: str,
                    command: str | None = None,
                    generate: bool = False) -> list[str]: </s> remove         pathexecscript = os.path.join(self.pathscript, script)
 </s> add         pathexecscript = os.path.join(os.path.realpath(os.path.dirname(sys.argv[0])), script) </s> remove         args = self.build_args(category)
        self.tk_vars.display.set(self.command)
 </s> add         args = self._build_args(category)
        self._tk_vars.display.set(self._command) </s> remove         category, command = self.tk_vars.generate_command.get().split(",")
        args = self.build_args(category, command=command, generate=True)
        self.tk_vars.console_clear.set(True)
        logger.debug(" ".join(args))
        print(" ".join(args))
        self.tk_vars.generate_command.set("")

    def prepare(self, category):
        """ Prepare the environment for execution """
 </s> add         category, command = self._tk_vars.generate_command.get().split(",")
        fs_args = self._build_args(category, command=command, generate=True)
        self._tk_vars.console_clear.set(True)
        logger.debug(" ".join(fs_args))
        print(" ".join(fs_args))
        self._tk_vars.generate_command.set("")

    def _prepare(self, category: T.Literal["faceswap", "tools"]) -> list[str]:
        """ Prepare the environment for execution, Sets the 'running task' and 'console clear'
        global tkinter variables. If training, sets the 'is training' variable

        Parameters
        ----------
        category: str, ["faceswap", "tools"]
            The script that is executing the command

        Returns
        -------
        list[str]
            The command line arguments to execute for the faceswap job
        """
        Parameters
        ----------
        category: str, ["faceswap", "tools"]
            The script that is executing the command
        command: str, optional
            The main faceswap command to execute, if provided. The currently running task if
            ``None``. Default: ``None``
        generate: bool, optional
            ``True`` if the command is just to be generated for display. ``False`` if the command
            is to be executed

        Returns
        -------
        list[str]
            The full faceswap command to be executed or displayed
          """ Build the faceswap command and arguments list.
  
          If training, pass the model folder and name to the training
          :class:`lib.gui.analysis.Session` for the GUI.
        Parameters
        ----------
        category: str, ["faceswap", "tools"]
            The script that is executing the command
        command: str, optional
            The main faceswap command to execute, if provided. The currently running task if
            ``None``. Default: ``None``
        generate: bool, optional
            ``True`` if the command is just to be generated for display. ``False`` if the command
            is to be executed

        Returns
        -------
        list[str]
            The full faceswap command to be executed or displayed
          """
          logger.debug("Build cli arguments: (category: %s, command: %s, generate: %s)",
                       category, command, generate)
          command = self._command if not command else command
keep keep keep add keep keep keep keep
 bugfix: GUI force stdout/stderr reading to utf-8 
lib/gui/wrapper.py