[issue35216] misleading error message from shutil.copy()

2021-03-17 Thread Eryk Sun
Change by Eryk Sun : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> shutil.copy raises IsADirectoryError when the directory does not actually exist ___ Python tracker ___

[issue35216] misleading error message from shutil.copy()

2018-11-13 Thread Eryk Sun
Eryk Sun added the comment: The EINVAL error in Windows also needs improvement, but I don't what can be done after the fact. If there's a trailing slash when opening or creating a regular file, the NtCreateFile system call returns STATUS_OBJECT_INVALID_NAME. The Windows API maps this to ERRO

[issue35216] misleading error message from shutil.copy()

2018-11-12 Thread Julien Palard
Julien Palard added the comment: Using `cp` on Debian Buster I'm having a better error message: $ touch foo $ cp foo bar/ cp: failed to access 'bar/': Not a directory >From copy.c (from Debian coreutils): /* Improve quality of diagnostic when a nonexistent dst_name end

[issue35216] misleading error message from shutil.copy()

2018-11-12 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: @vstinner & @serhiy What do you think about this issue? For the same POSIX syscall (open) we get 2 different values for the error, 2 on macOS and EISDIR with Linux. Is a bug in Python or with the compliance of the operating system and the POSIX norm? Than

[issue35216] misleading error message from shutil.copy()

2018-11-12 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: This error is specific to the C-API and not to Python, here is an example. #include #include #include #include #include int main(int argc, char **argv, char **environ) { int fd; fd = open("/tmp/toto/", O_CREAT); printf("file descriptor: %d\n

[issue35216] misleading error message from shutil.copy()

2018-11-12 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: You have the issue with the built-in 'open' function. -- nosy: +matrixise ___ Python tracker ___

[issue35216] misleading error message from shutil.copy()

2018-11-12 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Agreed this is confusing. Is this a Linux specific error? Trying this on Mac gives me a different error code and exception. # Mac $ ./python.exe Python 3.8.0a0 (heads/master:cd449806fa, Nov 12 2018, 09:51:24) [Clang 7.0.2 (clang-700.1.81)] on darwi

[issue35216] misleading error message from shutil.copy()

2018-11-12 Thread Cédric Van Rompay
New submission from Cédric Van Rompay : 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 forgo