shutil does not always accept path-like objects
Closed this issue · 3 comments
uwefladrich commented
uwefladrich commented
The solution is either to use pathlib
functions, where possible, or to convert path-like objects to strings before passing them to shutil.*
.
uwefladrich commented
shutil.move
accepts path-like objects, but only from version 3.9 on.
shutil.copy
is documented to accept path-like src
and dst
.
uwefladrich commented
Turns out that pathlib.Path.rename()
does not handle directory destinations in the same way as shutil.move()
. Hence, ee38815 does not really solve the problem for this task.