Skip to content

Commit 1a76182

Browse files
authored
Merge pull request #2092 from mwaskom/py3_exception_handling
Fix: String-based error inspection on Python 3
2 parents 5cc2702 + 7d71798 commit 1a76182

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nipype/interfaces/io.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def copytree(src, dst, use_hardlink=False):
7171
try:
7272
os.makedirs(dst)
7373
except OSError as why:
74-
if 'File exists' in why:
74+
if 'File exists' in why.strerror:
7575
pass
7676
else:
7777
raise why
@@ -687,7 +687,7 @@ def _list_outputs(self):
687687
try:
688688
os.makedirs(outdir)
689689
except OSError as inst:
690-
if 'File exists' in inst:
690+
if 'File exists' in inst.strerror:
691691
pass
692692
else:
693693
raise(inst)
@@ -738,7 +738,7 @@ def _list_outputs(self):
738738
try:
739739
os.makedirs(path)
740740
except OSError as inst:
741-
if 'File exists' in inst:
741+
if 'File exists' in inst.strerror:
742742
pass
743743
else:
744744
raise(inst)

0 commit comments

Comments
 (0)