fix: add error if no image provided upong starting
Python Lint CI / ruff-format-check (push) Canceled after 5m34s
Python Lint CI / ruff (push) Canceled after 5m36s
Python Lint CI / ty (push) Canceled after 5m33s

This commit is contained in:
2026-11-08 13:12:23 +01:00
parent 24a99ab788
commit d14836c109
+8 -1
View File
@@ -18,7 +18,9 @@ MAX_GLYPHS = 256
class Reader:
def __init__(self, params: Parameters) -> None:
self.source_image_path = pathlib.Path(params.source_image_path)
self.source_image_path = (
pathlib.Path(params.source_image_path) if params.source_image_path else None
)
self.source_names_path = (
pathlib.Path(params.source_names_path) if params.source_names_path else None
)
@@ -60,6 +62,11 @@ class Reader:
return self.__read_sentences(names)
def __read_image(self) -> list[Glyph]:
if not self.source_image_path:
self.log.error(
"No input image provided"
)
sys.exit(1)
try:
img = Image.open(self.source_image_path).convert("1")
if img.width % 8 != 0 or img.height % 8 != 0: