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 <rep...@bugs.python.org>
<http://bugs.python.org/issue23241>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to