{"record":{"id":"5fca6d422eee4e38","repo":"deepfakes/faceswap","slug":"the-output-location-self-location-is-not-a-fol","errorCode":null,"errorMessage":"The output location '{self.location}' is not a folder","messagePattern":"The output location '(.+?)' is not a folder","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"lib/image.py","lineNumber":1304,"sourceCode":"    def __init__(self, path, queue_size=8, as_bytes=False):\n        logger.debug(parse_class_init(locals()))\n        super().__init__(path, queue_size=queue_size)\n        self._as_bytes = as_bytes\n\n    def _check_location_exists(self):\n        \"\"\" Check whether the output location exists and is a folder\n\n        Raises\n        ------\n        FaceswapError\n            If the given location does not exist or the location is not a folder\n        \"\"\"\n        if not isinstance(self.location, str):\n            raise FaceswapError(\"The output location must be a string not a \"\n                                f\"{type(self.location)}\")\n        super()._check_location_exists()\n        if not os.path.isdir(self.location):\n            raise FaceswapError(f\"The output location '{self.location}' is not a folder\")\n\n    def _process(self, queue):\n        \"\"\" Saves images from the save queue to the given :attr:`location` inside a thread.\n\n        Parameters\n        ----------\n        queue: queue.Queue()\n            The ImageIO Queue\n        \"\"\"\n        executor = futures.ThreadPoolExecutor(thread_name_prefix=self.__class__.__name__)\n        assert self._error_state is not None\n        while True:\n            if self._error_state.has_error:\n                logger.debug(\"[%s] Thread error detected in worker thread\", self._name)\n                executor.shutdown(cancel_futures=True)\n                return\n            item = queue.get()\n            if item == \"EOF\":","sourceCodeStart":1286,"sourceCodeEnd":1322,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/lib/image.py#L1286-L1322","documentation":"ImagesSaver's second guard: the output location exists (superclass check passed) but is not a directory. Saving to a path that is a regular file, or a dangling symlink, raises this FaceswapError.","triggerScenarios":"Passing an output path that points at an existing file (e.g. an output video filename instead of a folder), or a symlink whose target was removed.","commonSituations":"Confusing the -o output folder argument with an output filename in extract jobs; reusing a file path as output dir; leftover symlink from a moved drive.","solutions":["Point the output location at a folder (create it first if needed: mkdir -p).","If the path is an unwanted leftover file, delete or rename it.","Fix dangling symlinks to point at the real directory."],"exampleFix":"import os\n\n# before\nsaver = ImagesSaver('/out/faces.mp4')  # exists but is a file\n\n# after\nos.makedirs('/out/faces', exist_ok=True)\nsaver = ImagesSaver('/out/faces')","handlingStrategy":"validation","validationCode":"import os\n\nos.makedirs(output_location, exist_ok=True)\nassert os.path.isdir(output_location), 'output location is not a folder'","typeGuard":null,"tryCatchPattern":"try:\n    saver = ImagesSaver(out_path)\nexcept FaceswapError as err:\n    if 'not a folder' in str(err):\n        out_path = out_path + '_dir'\n        os.makedirs(out_path, exist_ok=True)\n        saver = ImagesSaver(out_path)\n    else:\n        raise","preventionTips":["mkdir -p the output folder in launcher scripts.","Use distinct arguments for output folder vs output filename.","Never point -o at an existing file path."],"tags":["filesystem","path","validation","io"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}