From 52d6e3461e1da9717b8670db4f9623c2825bb8a0 Mon Sep 17 00:00:00 2001 From: Lea Waller Date: Thu, 29 Jul 2021 20:07:24 +0200 Subject: [PATCH] Ignore `.nfs` placeholder files when catching the error - I forgot that `os.listdir` also lists hidden files in the previous commit --- nipype/utils/filemanip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipype/utils/filemanip.py b/nipype/utils/filemanip.py index e009608b77..f51e35c6b3 100644 --- a/nipype/utils/filemanip.py +++ b/nipype/utils/filemanip.py @@ -780,7 +780,7 @@ def emptydirs(path, noexist_ok=False): try: shutil.rmtree(path) except OSError as ex: - elcont = os.listdir(path) + elcont = [p for p in os.listdir(path) if not p.startswith(".nfs")] if ex.errno in [errno.ENOTEMPTY, errno.EBUSY] and not elcont: fmlogger.warning( "An exception was raised trying to remove old %s, but the path"