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: