Osama Billah
Osama Billah

Reputation: 101

How to copy file through Shutil python

I was trying to copy file from my desktop to System32 dir. it give me the following error.

PermissionError: [Errno 13] Permission denied:'C:/Windows/System32/abc.exe'

here is my code

    src = pth + "\\" +s_name
    dist = "C:/Windows/System32/"
    shutil.copy(src , dist)

Upvotes: 0

Views: 232

Answers (1)

vkozyrev
vkozyrev

Reputation: 1978

The issue is not with Python or shutil. Permission denied means that the user that runs the Python script does not have a permission to copy the file to C:/Windows/System32.

I think what you could do now is to look for a way to run the script as Windows administrator.

Upvotes: 2

Related Questions