From b79437a6917a180a98941c70392040da8ec1a969 Mon Sep 17 00:00:00 2001 From: yanghua Date: Sat, 21 Sep 2024 09:47:24 +0800 Subject: [PATCH] MPU: Init staging dirs if not exist --- tosfs/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tosfs/core.py b/tosfs/core.py index a7ced85..bb62302 100644 --- a/tosfs/core.py +++ b/tosfs/core.py @@ -2060,6 +2060,12 @@ def __init__( self.append_block = True self.loc = loc + if "w" in mode: + # check the local staging dir if not exist, create it + for staging_dir in fs.multipart_staging_dirs: + if not os.path.exists(staging_dir): + os.makedirs(staging_dir) + def _initiate_upload(self) -> None: """Create remote file/upload.""" if self.autocommit and not self.append_block and self.tell() < self.blocksize: