darabos commited on
Commit
df391ed
·
1 Parent(s): becba58

Create the data directory if it doesn't exist.

Browse files
lynxkite-core/src/lynxkite/core/workspace.py CHANGED
@@ -67,6 +67,7 @@ def save(ws: Workspace, path: str):
67
  """Persist a workspace to a local file in JSON format."""
68
  j = ws.model_dump_json(indent=2)
69
  dirname, basename = os.path.split(path)
 
70
  # Create temp file in the same directory to make sure it's on the same filesystem.
71
  with tempfile.NamedTemporaryFile(
72
  "w", prefix=f".{basename}.", dir=dirname, delete=False
 
67
  """Persist a workspace to a local file in JSON format."""
68
  j = ws.model_dump_json(indent=2)
69
  dirname, basename = os.path.split(path)
70
+ os.makedirs(dirname, exist_ok=True)
71
  # Create temp file in the same directory to make sure it's on the same filesystem.
72
  with tempfile.NamedTemporaryFile(
73
  "w", prefix=f".{basename}.", dir=dirname, delete=False