Skip to content
Snippets Groups Projects

catch the case where directory no longer exists

Merged Charlotte Hausman requested to merge fix_dir_not_exist_abort_error into main
1 file
+ 10
7
Compare changes
  • Side-by-side
  • Inline
@@ -117,10 +117,13 @@ class CapoInjector:
def clear_subspace(self):
logger.info(f"Clearing capo subspace file from {self.dir_path.__str__()}...")
for file in os.listdir(self.dir_path):
if file.endswith(".properties"):
Path.unlink(self.dir_path / file)
check = glob.glob("*.properties")
if check is None:
logger.info("Capo subspace cleared successfully.")
if Path(self.dir_path).exists():
for file in os.listdir(self.dir_path):
if file.endswith(".properties"):
Path.unlink(self.dir_path / file)
check = glob.glob("*.properties")
if check is None:
logger.info("Capo subspace cleared successfully.")
else:
logger.info(f"Directory {self.dir_path} has already been cleaned.")
Loading