To solve Python IOError: [Errno 13] Permission denied: while copying file in python error follow below methods.
File "C:\Python27\lib\shutil.py", line 34, in copyfile with open('file.txt', 'wb') as f: IOError: [Errno 13] Permission denied:
How to solve Python. IOError: [Errno 13] Permission denied while copying file ?
To solve this error use shutil.copy instead of shutil.copyfile. Shutil provides a range of high-level operations on files and file collections. There are functions that assist file copying and removal in particular. See also the os module for operations on specific files.
If you want to use shutil.copyfile the read the following lines :
Copy the contents of the src file (no metadata) to a file named dst and return dst as quickly as possible. Path-like objects or path names presented as strings are src and dst.
dst must be the full target file name; for a copy that accepts a target directory path, see copy(). SameFileError is generated if src and dst indicate the same file.
Hope the above solution works.
Also read :
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour
Error: cv2.error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function ‘rectangle’