[issue35216] misleading error message from shutil.copy()
Karthikeyan Singaravelan
report at bugs.python.org
Mon Nov 12 08:25:16 EST 2018
Karthikeyan Singaravelan <tir.karthi at gmail.com> 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 darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.copy('/tmp/a.py', 'Lib12/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/shutil.py", line 385, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/shutil.py", line 240, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'Lib12/'
# Ubuntu
./python
Python 3.8.0a0 (heads/master:dce345c51a, Nov 12 2018, 13:01:05)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> shutil.copy('/tmp/a.py', 'Lib12/')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/karthi/cpython/Lib/shutil.py", line 386, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/home/karthi/cpython/Lib/shutil.py", line 241, in copyfile
with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
IsADirectoryError: [Errno 21] Is a directory: 'Lib12/'
----------
nosy: +xtreak
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35216>
_______________________________________
More information about the Python-bugs-list
mailing list