deepfakes/faceswap · error · FaceswapError
The output location '{self.location}' is not a folder
Error message
The output location '{self.location}' is not a folder What it means
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.
Source
Thrown at lib/image.py:1304
def __init__(self, path, queue_size=8, as_bytes=False):
logger.debug(parse_class_init(locals()))
super().__init__(path, queue_size=queue_size)
self._as_bytes = as_bytes
def _check_location_exists(self):
""" Check whether the output location exists and is a folder
Raises
------
FaceswapError
If the given location does not exist or the location is not a folder
"""
if not isinstance(self.location, str):
raise FaceswapError("The output location must be a string not a "
f"{type(self.location)}")
super()._check_location_exists()
if not os.path.isdir(self.location):
raise FaceswapError(f"The output location '{self.location}' is not a folder")
def _process(self, queue):
""" Saves images from the save queue to the given :attr:`location` inside a thread.
Parameters
----------
queue: queue.Queue()
The ImageIO Queue
"""
executor = futures.ThreadPoolExecutor(thread_name_prefix=self.__class__.__name__)
assert self._error_state is not None
while True:
if self._error_state.has_error:
logger.debug("[%s] Thread error detected in worker thread", self._name)
executor.shutdown(cancel_futures=True)
return
item = queue.get()
if item == "EOF":View on GitHub (pinned to f530cb7508)
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.
Example fix
import os
# before
saver = ImagesSaver('/out/faces.mp4') # exists but is a file
# after
os.makedirs('/out/faces', exist_ok=True)
saver = ImagesSaver('/out/faces') Defensive patterns
Strategy: validation
Validate before calling
import os os.makedirs(output_location, exist_ok=True) assert os.path.isdir(output_location), 'output location is not a folder'
Try / catch
try:
saver = ImagesSaver(out_path)
except FaceswapError as err:
if 'not a folder' in str(err):
out_path = out_path + '_dir'
os.makedirs(out_path, exist_ok=True)
saver = ImagesSaver(out_path)
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The location '{self.location}' does not exist
- Not all locations in the input list exist
- Error reading from '{filename}': {err.strerror}
- PermissionError while reading: {filename}
- The output location must be a string not a {type(self.locati
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/5fca6d422eee4e38.
Report an issue: GitHub.