[issue19717] resolve() fails when the path doesn't exist
Antoine Pitrou
report at bugs.python.org
Tue Dec 3 00:23:37 CET 2013
Antoine Pitrou added the comment:
I think there's value in allowing the "less strict" behaviour with an optional arg, though. i.e.:
>>> Path('toto').resolve()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/antoine/cpython/default/Lib/pathlib.py", line 1024, in resolve
s = self._flavour.resolve(self)
File "/home/antoine/cpython/default/Lib/pathlib.py", line 282, in resolve
target = accessor.readlink(cur)
File "/home/antoine/cpython/default/Lib/pathlib.py", line 372, in readlink
return os.readlink(path)
FileNotFoundError: [Errno 2] No such file or directory: '/home/antoine/cpython/default/toto'
>>> Path('toto').resolve(strict=False)
PosixPath('/home/antoine/cpython/default/toto')
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19717>
_______________________________________
More information about the Python-bugs-list
mailing list