[New-bugs-announce] [issue23241] shutil should accept pathlib types
Michael Kesper
report at bugs.python.org
Wed Jan 14 14:02:56 CET 2015
New submission from Michael Kesper:
source_path = Path('../data')
destination_path = Path('//file_server/work/whatever')
for file_name in source_path.glob('xyz-*'):
shutil.copyfile(source_path / file_name, destination_path / file_name)
leads to:
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 copyfile
if _samefile(src, dst):
File "C:\Python34\lib\shutil.py", line 75, in _samefile
return 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
Converting to str() works but is unexpected.
----------
messages: 234025
nosy: mkesper
priority: normal
severity: normal
status: open
title: shutil should accept pathlib types
type: behavior
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23241>
_______________________________________
More information about the New-bugs-announce
mailing list