close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Python. IOError: [Errno 13] Permission denied: when i’m copying file in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Python. IOError: [Errno 13] Permission denied: when i’m copying file Error Occurs?

Today I get the following error Python. IOError: [Errno 13] Permission denied: when i’m copying file in python.

How To Solve Python. IOError: [Errno 13] Permission denied: when i’m copying file Error ?

  1. How To Solve Python. IOError: [Errno 13] Permission denied: when i'm copying file Error ?

    To Solve Python. IOError: [Errno 13] Permission denied: when i'm copying file Error use shutil.copy instead of shutil.copyfile
    example:
    shutil.copy(PathOf_SourceFileName.extension,TargetFolderPath)

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

    To Solve Python. IOError: [Errno 13] Permission denied: when i'm copying file Error use shutil.copy instead of shutil.copyfile
    example:
    shutil.copy(PathOf_SourceFileName.extension,TargetFolderPath)

Solution 1

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)

Solution 2

use shutil.copy instead of shutil.copyfile

example:

shutil.copy(PathOf_SourceFileName.extension,TargetFolderPath)

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read