[New-bugs-announce] [issue33004] Shutil module functions could accept Path-like objects
Marco Rougeth
report at bugs.python.org
Mon Mar 5 17:39:41 EST 2018
New submission from Marco Rougeth <marco at rougeth.com>:
This is issue is to suggest an enhancement to the shutil module, I believe it's quiet similar to the issue32642.
I was using shutil.copytree to copy some files around and I tried to pass Path-like objects as input but got the exception "TypeError: argument should be string, bytes or integer, not PosixPath".
e.g.
build_path = BASE_DIR / 'build'
static_path = BASE_DIR / 'static'
shutil.copytree(static_path, build_path)
As said in issue32642, it "wasn't obvious because Path objects appear as strings in normal debug output". I had a look at the shutil source code and it seems that it wouldn't be to hard to implement. I'd love to do it, if it makes sense.
----------
components: Library (Lib)
messages: 313295
nosy: rougeth
priority: normal
severity: normal
status: open
title: Shutil module functions could accept Path-like objects
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33004>
_______________________________________
More information about the New-bugs-announce
mailing list