Message359745
Python version: Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
The usage of symlink_to() is link.symlink_to(target)
while the usage of link_to() is target.link_to(link).
This could be confusing.
Here is an example:
>>> import pathlib
>>> target = pathlib.Path('target.txt')
>>> p1 = pathlib.Path('symlink.txt')
>>> p2 = pathlib.Path('hardlink.txt')
>>> p1.symlink_to(target)
>>> p2.link_to(target) # expected usage
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Program Files\Python38\lib\pathlib.py", line 1346, in link_to
self._accessor.link_to(self, target)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'hardlink.txt' -> 'target.txt'
>>> target.link_to(p2) # current usage
>>>
Since os.symlink() and os.link() have the same argument order,
>>> import os
>>> os.symlink('target.txt', 'symlink.txt')
>>> os.link('target.txt', 'hardlink.txt')
>>>
it would be nicer if the pathlib has the same argument order too. |
|
Date |
User |
Action |
Args |
2020-01-10 17:50:14 | Rockmizu | set | recipients:
+ Rockmizu |
2020-01-10 17:50:14 | Rockmizu | set | messageid: <1578678614.26.0.0980677925629.issue39291@roundup.psfhosted.org> |
2020-01-10 17:50:14 | Rockmizu | link | issue39291 messages |
2020-01-10 17:50:13 | Rockmizu | create | |
|