From 5bbde65b9d72448ca1566d2fe52142e3e1c85eca Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Fri, 12 Nov 2021 10:22:35 +0000 Subject: [PATCH] BF: Input files for wrapper functions were not being deleted --- fsl/wrappers/wrapperutils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fsl/wrappers/wrapperutils.py b/fsl/wrappers/wrapperutils.py index ac647674b..260841d4b 100644 --- a/fsl/wrappers/wrapperutils.py +++ b/fsl/wrappers/wrapperutils.py @@ -1047,7 +1047,8 @@ def fileOrImage(*args, **kwargs): # in-memory image - we have # to save it out to a file if infile is None: - hd, infile = tempfile.mkstemp(fslimage.defaultExt()) + hd, infile = tempfile.mkstemp(fslimage.defaultExt(), + dir=workdir) os.close(hd) val.to_filename(infile) @@ -1110,7 +1111,7 @@ def fileOrArray(*args, **kwargs): infile = None if isinstance(val, np.ndarray): - hd, infile = tempfile.mkstemp('.txt') + hd, infile = tempfile.mkstemp('.txt', dir=workdir) os.close(hd) np.savetxt(infile, val, fmt='%0.18f') @@ -1176,6 +1177,7 @@ def fileOrText(*args, **kwargs): if not isinstance(val, pathlib.Path): with tempfile.NamedTemporaryFile(mode='w', suffix='.txt', + dir=workdir, delete=False) as f: f.write(val) infile = f.name -- GitLab