From f513b829ef21854d4fac930715d181ef733c0da1 Mon Sep 17 00:00:00 2001 From: Tom van der Weide Date: Mon, 2 Dec 2024 05:23:03 -0800 Subject: [PATCH] Create the subfolder if it doesn't exist when creating an incomplete file PiperOrigin-RevId: 701932156 --- tensorflow_datasets/core/utils/py_utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow_datasets/core/utils/py_utils.py b/tensorflow_datasets/core/utils/py_utils.py index 403c8b513f8..9512269a682 100644 --- a/tensorflow_datasets/core/utils/py_utils.py +++ b/tensorflow_datasets/core/utils/py_utils.py @@ -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)