check whether paths exist for import

This commit is contained in:
Justus Kuhlmann 2026-05-05 16:26:02 +02:00
commit 6c99653fff
Signed by: jkuhl
GPG key ID: 00ED992DD79B85A6

View file

@ -158,6 +158,10 @@ def import_toml(path: Path, file: str, copy_file: bool=True) -> None:
copy_file: bool, optional copy_file: bool, optional
Whether the toml-files will be copied into the library. Default is True. Whether the toml-files will be copied into the library. Default is True.
""" """
if not os.path.exists(path):
raise FileNotFoundError(f"Corrlib path {path} does not exist.")
if not os.path.exists(file):
raise FileNotFoundError(f".toml-file {file} does not exist.")
print("Import project as decribed in " + file) print("Import project as decribed in " + file)
with open(file, 'rb') as fp: with open(file, 'rb') as fp:
toml_dict = toml.load(fp) toml_dict = toml.load(fp)