deepfakes/faceswap · error · FaceswapError
The output location must be a string not a {type(self.locati
Error message
The output location must be a string not a {type(self.location)} What it means
ImagesSaver overrides _check_location_exists and requires the output location to be a string (a single folder path). Passing a list/tuple of destinations, None, or a Path-like object raises this FaceswapError before the superclass existence check runs.
Source
Thrown at lib/image.py:1300
>>> saver.save(filename, image)
>>> saver.close()
"""
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)View on GitHub (pinned to f530cb7508)
Solutions
- Pass a single string folder path to ImagesSaver.
- Default unset config values to a concrete string output folder.
- Wrap Path objects with str(...) if using pathlib.
Example fix
# before
saver = ImagesSaver(['/out/a', '/out/b']) # FaceswapError
# after
saver = ImagesSaver('/out/a') # one output folder only Defensive patterns
Strategy: type-guard
Validate before calling
if not isinstance(output_location, str) or not output_location:
raise SystemExit('output location must be a non-empty string folder path') Type guard
def is_valid_output_location(loc) -> bool:
return isinstance(loc, str) and len(loc) > 0 Try / catch
try:
saver = ImagesSaver(loc)
except FaceswapError as err:
if 'must be a string' in str(err):
loc = str(loc[0]) if isinstance(loc, (list, tuple)) else str(loc)
saver = ImagesSaver(loc)
else:
raise Prevention
- Normalize config-sourced output paths to str early.
- Default None output configs to a concrete folder string.
- Remember ImagesSaver takes exactly one folder, never a list.
When it happens
Trigger: Constructing ImagesSaver with a list of output folders (only one folder is supported), with None because a config variable was unset, or with pathlib.Path on versions expecting str.
Common situations: Reusing an input list for the output argument; config parsing that yields None; scripts building output paths programmatically and passing a non-string.
Related errors
- Config file does not exist at: {ini_path}
- No display detected. GUI mode has been disabled.
- [{self._name}] List values should be set as a Str or List. G
- [{self._name}] Expected {self.datatype} got {type(value)} ({
- Metadata is only supported for .png and .tif images
AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15).
Data as JSON: /api/errors/a08160cea6edb9a5.
Report an issue: GitHub.