From ecbdb408ea78de73cbe628f8021c148ee958b5be Mon Sep 17 00:00:00 2001 From: Bart Schilperoort Date: Fri, 26 Jul 2024 10:51:19 +0200 Subject: [PATCH] Change how tempdir works on windows --- src/zampy/datasets/fapar_lai.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/zampy/datasets/fapar_lai.py b/src/zampy/datasets/fapar_lai.py index b716620..c026a3f 100644 --- a/src/zampy/datasets/fapar_lai.py +++ b/src/zampy/datasets/fapar_lai.py @@ -1,5 +1,6 @@ """Implementation of the FAPAR LAI dataset.""" +import os import shutil import tempfile import zipfile @@ -119,7 +120,10 @@ def ingest( # netCDF files follow CF-1.6, only unpacking the archives is required. for file in zip_files: - with tempfile.TemporaryDirectory(dir=tmp_path) as _tmpdir: + with tempfile.TemporaryDirectory( + dir=tmp_path, + ignore_cleanup_errors=True if os.name == "nt" else False, + ) as _tmpdir: tmpdir = Path(_tmpdir) extract_fapar_zip(