Skip to content

Commit 92977f9

Browse files
committed
improved exception passing
1 parent 0530071 commit 92977f9

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

nipype/pipeline/engine.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,16 +1391,13 @@ def run(self, updatehash=False):
13911391
try:
13921392
rmtree(outdir)
13931393
except OSError as ex:
1394-
if ex.errno == errno.ENOTEMPTY:
1395-
logger.warn('Folder %s is not empty' % outdir)
1396-
logger.debug('Folder contents: %s' % ",".join(os.listdir(outdir)))
1397-
for f in os.listdir(outdir):
1398-
if op.isfile(f):
1399-
os.remove(f)
1400-
else:
1401-
rmtree(f)
1402-
else:
1403-
raise ex
1394+
outdircont = os.listdir(outdir)
1395+
if ((ex.errno == errno.ENOTEMPTY) and (len(outdircont) == 0)):
1396+
logger.warn(('An exception was raised trying to remove old %s, '
1397+
'but the path seems empty. Is it an NFS mount?. '
1398+
'Passing the exception.') % outdir)
1399+
pass
1400+
raise ex
14041401

14051402
else:
14061403
logger.debug(("%s found and can_resume is True or Node is a "

0 commit comments

Comments
 (0)