check whether paths exist for import
This commit is contained in:
parent
2f83c1f9cb
commit
6c99653fff
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue