Message329728
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". |
|
Date |
User |
Action |
Args |
2018-11-12 12:19:11 | cedricvanrompay | set | recipients:
+ cedricvanrompay |
2018-11-12 12:19:11 | cedricvanrompay | set | messageid: <1542025151.44.0.788709270274.issue35216@psf.upfronthosting.co.za> |
2018-11-12 12:19:11 | cedricvanrompay | link | issue35216 messages |
2018-11-12 12:19:11 | cedricvanrompay | create | |
|