From 7d6c3ac27031ddbfec2ebf5894c4ab890067da03 Mon Sep 17 00:00:00 2001 From: tiagodc Date: Mon, 24 Aug 2020 11:33:12 -0300 Subject: [PATCH] fix #1151 - check for symbolic links before removing directories in run_opensfm.py Former-commit-id: 85ea7c39a4608ad72e948fb1fc3305bdf6abfb85 --- stages/run_opensfm.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/stages/run_opensfm.py b/stages/run_opensfm.py index 7ceefd89..a5bf34c1 100644 --- a/stages/run_opensfm.py +++ b/stages/run_opensfm.py @@ -34,10 +34,12 @@ class ODMOpenSfMStage(types.ODM_Stage): self.update_progress(70) if args.optimize_disk_space: - shutil.rmtree(octx.path("features")) - shutil.rmtree(octx.path("matches")) - shutil.rmtree(octx.path("exif")) - shutil.rmtree(octx.path("reports")) + for folder in ["features", "matches", "exif", "reports"]: + folder_path = octx.path(folder) + if os.path.islink(folder_path): + os.unlink(folder_path) + else: + shutil.rmtree(folder_path) # If we find a special flag file for split/merge we stop right here if os.path.exists(octx.path("split_merge_stop_at_reconstruction.txt")):