New submission from Cédric Van Rompay <cedric.vanrom...@gmail.com>:
When calling `shutil.copy('file.txt', 'not_here/')`, if directory `not_here/` does not exist, the raised error is: IsADirectoryError: [Errno 21] Is a directory: 'not_here/' If the intent of the user was to copy a file in a directory but the user forgot to create the destination directory, this can be very misleading, as the error tends to indicate that the directory exists. It happened to me and I was thinking "yes it's a directory, then what? that's exactly what I want,copy to this directory!" when the problem was that I forgot to create the destination directory. I would suggest to catch the `IsADirectoryError` in shutil.copyfile() (at `open(dst, 'wb')`) and raise instead an error saying something like "destination is a directory AND this directory does not exists". ---------- components: Library (Lib) messages: 329728 nosy: cedricvanrompay priority: normal severity: normal status: open title: misleading error message from shutil.copy() type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35216> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com