checks for nonexistent dirs

This commit is contained in:
Tomáš Mládek 2021-09-19 13:41:38 +02:00
parent 9a13c3c393
commit 405fd3cad5

View file

@ -121,9 +121,13 @@ class KollagenBot:
return False
directories = [
os.path.join(self.base_dir or "./", dir) for dir in args.directories
(dir, os.path.join(self.base_dir or "./", dir)) for dir in args.directories
]
for orig_dir, full_path in directories:
if not os.path.exists(full_path):
raise FileNotFoundError(f'"{orig_dir}" does not exist.')
mode = ["-m", args.mode] if args.mode else []
num_images = ["-n", str(args.num_images)] if args.num_images else []
@ -131,7 +135,7 @@ class KollagenBot:
shell_cmd_line = [
self.kollagen_path,
"-r",
*directories,
*[full_path for _, full_path in directories],
"-w",
str(args.width),
"-h",