Skip to content

Commit

Permalink
check temporary directory existence before executing method
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamaedler committed Apr 28, 2024
1 parent 967c2e4 commit 3369cdb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sparcscore/pipeline/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import warnings
import shutil
import tempfile

import sys

class Logable(object):
"""
Expand Down Expand Up @@ -135,6 +135,10 @@ def __call__(
if not os.path.isdir(self.directory):
os.makedirs(self.directory)

print(f"Temp directory {self._tmp_dir} for method {self.__class__.__name__}")
if not os.path.isdir(self._tmp_dir.name):
sys.exit("Temporary directory not found, exiting...")

process = getattr(self, "process", None)
if callable(process):
x = self.process(*args, **kwargs)
Expand Down

0 comments on commit 3369cdb

Please sign in to comment.