You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "copy_shares_2_work.py", line 9, in <module>
shutil.copyfile(source_path / file_name, destination_path / file_name)
File "C:\Python34\lib\shutil.py", line 90, in copyfileif _samefile(src, dst):
File "C:\Python34\lib\shutil.py", line 75, in _samefilereturn os.path.samefile(src, dst)
File "C:\Python34\lib\genericpath.py", line 90, in samefile
s1 = os.stat(f1)
TypeError: argument should be string, bytes or integer, not WindowsPath
This is a specific example of a global discussion about handling of paths in the stdlib. So far we have elected not to provide special handling. The correct thing to do is call str. I'm not sure if shutil is special enough to be a special case, but it would need to be discussed in the context of the larger issue in some forum other than the bug tracker (probably python-dev).
Activity
mkesper commentedon Jan 14, 2015
leads to:
Converting to str() works but is unexpected.
bitdancer commentedon Jan 14, 2015
This is a specific example of a global discussion about handling of paths in the stdlib. So far we have elected not to provide special handling. The correct thing to do is call str. I'm not sure if shutil is special enough to be a special case, but it would need to be discussed in the context of the larger issue in some forum other than the bug tracker (probably python-dev).
serhiy-storchaka commentedon Mar 26, 2017
Is this issue outdated since implementing a file system path protocol (PEP-519) in 3.6?
vstinner commentedon Mar 27, 2017
I'm unable to reproduce the bug on Python 3.6:
---
Output:
---
PosixPath('a/y') -> PosixPath('b/y')
PosixPath('a/x') -> PosixPath('b/x')
PosixPath('a/z') -> PosixPath('b/z')
---
Thank you PEP-519 ;-)