Skip to content

Commit

Permalink
Create the subfolder if it doesn't exist when creating an incomplete …
Browse files Browse the repository at this point in the history
…file

PiperOrigin-RevId: 701935891
  • Loading branch information
tomvdw authored and The TensorFlow Datasets Authors committed Dec 2, 2024
1 parent 340664b commit 2d75769
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tensorflow_datasets/core/utils/py_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def incomplete_file(
) -> Iterator[epath.Path]:
"""Writes to path atomically, by writing to temp file and renaming it."""
tmp_path = _tmp_file_name(path, subfolder=subfolder)
tmp_path.parent.mkdir(exist_ok=True)
try:
yield tmp_path
tmp_path.replace(path)
Expand Down

0 comments on commit 2d75769

Please sign in to comment.