Skip to content

Commit 5189850

Browse files
committed
Fix bad logic.
1 parent a71a0ba commit 5189850

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/py/kaleido/_page_generator.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ def _ensure_path(path: Path | str | tuple[str | Path, str]) -> None:
2525
_logger.debug(f"Parsed file path: {parsed}")
2626
if parsed.scheme.startswith("http"): # is url
2727
return
28-
elif (
29-
parsed.scheme.startswith("file")
30-
and not (_p := Path(url2pathname(parsed.path))).exists()
31-
):
28+
elif parsed.scheme.startswith("file"):
29+
if (_p := Path(url2pathname(parsed.path))).exists():
30+
return
3231
_logger.error(f"File parsed to: {_p}")
33-
raise FileNotFoundError(f"{path!s} does not exist.")
34-
if not Path(path).exists():
35-
raise FileNotFoundError(f"{path!s} does not exist.")
32+
elif Path(path).exists():
33+
return
34+
raise FileNotFoundError(f"{path!s} does not exist.")
3635

3736

3837
class PageGenerator:

0 commit comments

Comments
 (0)