Skip to content

Commit 6d4e821

Browse files
committed
FIX: Handle missing paths better pre-3.6
1 parent 2328beb commit 6d4e821

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

nipype/utils/filemanip.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,19 @@ def path_resolve(path, strict=False):
6464
try:
6565
return path.resolve(strict=strict)
6666
except TypeError: # PY35
67-
resolved = path.resolve()
68-
if strict and not resolved.exists():
69-
raise FileNotFoundError(resolved)
70-
return resolved
67+
pass
68+
69+
path = path.absolute()
70+
if strict or path.exists():
71+
try:
72+
return path.resolve()
73+
except OSError:
74+
raise FileNotFoundError(str(path))
75+
76+
# This is a hacky shortcut, using path.absolute() unmodified
77+
# In cases where the existing part of the path contains a
78+
# symlink, different results will be produced
79+
return path
7180

7281

7382
def path_mkdir(path, mode=0o777, parents=False, exist_ok=False):

0 commit comments

Comments
 (0)