From 3e2ed659711ed8de5cabe5f3758d7c21ae91e78e Mon Sep 17 00:00:00 2001 From: Eric Duminil <eric.duminil@gmail.com> Date: Mon, 17 Jun 2024 14:02:19 +0200 Subject: [PATCH] Check if SimStadt is installed --- download_files_from_LGL_BW.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/download_files_from_LGL_BW.py b/download_files_from_LGL_BW.py index d9f325e..bbb408b 100644 --- a/download_files_from_LGL_BW.py +++ b/download_files_from_LGL_BW.py @@ -46,7 +46,15 @@ SCRIPT_DIR = Path(__file__).parent WAIT_BETWEEN_DOWNLOADS = 5 # [s] Be nice to LGL Server. if EXTRACT_REGIONS: - SIMSTADT_FOLDER = next(Path.home().glob('Desktop/SimStadt*_0.*/')) + try: + SIMSTADT_FOLDER = next(x for x in Path.home().glob('Desktop/SimStadt*_0.*/') if x.is_dir()) + print(f"RegionChooser has been found in {SIMSTADT_FOLDER}") + except StopIteration: + exit("No SimStadt installation found!" + "\nPlease copy a SimStadt installation to the desktop," + "\nset EXTRACT_REGIONS to False," + "\nor set SIMSTADT_FOLDER manually: SIMSTADT_FOLDER = Path('/path/to/SimStadt')" + ) GML_GLOB = "LoD2_*/LoD2_*.gml" -- GitLab