From 289f1274fc40e4b81b6ca94cc222b2abd2adda94 Mon Sep 17 00:00:00 2001 From: Fabian Zills Date: Mon, 26 Aug 2024 14:33:41 +0200 Subject: [PATCH 1/2] check if filename exits before starting server --- zndraw/cli.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/zndraw/cli.py b/zndraw/cli.py index c332197c..f84df7ed 100644 --- a/zndraw/cli.py +++ b/zndraw/cli.py @@ -6,6 +6,7 @@ import datetime import os import typing as t +import pathlib import typer @@ -166,6 +167,11 @@ def main( env_config.save_to_env() + if remote is None and rev is None: + if not pathlib.Path(filename).exists(): + typer.echo(f"File {filename} does not exist.") + raise typer.Exit(code=1) + if standalone and url is None: if env_config.FLASK_STORAGE.startswith("znsocket"): # standalone with redis would assume a running instance of redis From c3d20ca2d976a201b530133b9741e0c86d383217 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:34:35 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- zndraw/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zndraw/cli.py b/zndraw/cli.py index f84df7ed..07d9bef6 100644 --- a/zndraw/cli.py +++ b/zndraw/cli.py @@ -5,8 +5,8 @@ import dataclasses import datetime import os -import typing as t import pathlib +import typing as t import typer