Python. IOError: [Errno 13] Permission denied: when i'm copying file

Read the docs:

shutil.copyfile(src, dst)

Copy the contents (no metadata) of the file named src to a file named dst. dst must be the complete target file name; look at copy() for a copy that accepts a target directory path.


use shutil.copy instead of shutil.copyfile

example:

shutil.copy(PathOf_SourceFileName.extension,TargetFolderPath)

I solved this problem, you should be the complete target file name for destination

destination = pathdirectory + filename.*

I use this code fir copy wav file with shutil :

    # open file with QFileDialog

    browse_file = QFileDialog.getOpenFileName(None, 'Open file', 'c:', "wav files (*.wav)")

    # get file name 

    base = os.path.basename(browse_file[0])
    os.path.splitext(base)
    print(os.path.splitext(base)[1])

    # make destination path with file name

    destination= "test/" + os.path.splitext(base)[0] + os.path.splitext(base)[1]
    shutil.copyfile(browse_file[0], destination)