"IOError [Errno 13] Permisson denies" when copying a file to Windows "

I wrote a program that will copy a file named a.exe to C:/Windows/ , and then pack it into exe using PyInstaller and rename the exe file to a.exe file. When I run the exe file, it IOError [Errno 13] Permisson denied: 'C:/Windows/a.exe' , but the a.exe file a.exe copied to the C:/Windows directory . Then I launched it as an Administrator, it happened again ... First I copy the file with shututil.copy , then I wrote the function myself (open a.exe, create a.exe under C: / Windows, read the contents of a.exe and write to C: /Windows/a.exe, close everything), but that doesn’t help ... Any ideas?

+4
source share
3 answers

Check if the a.exe attribute has a read-only attribute. shutil.copy throws a "Permission denied" error when called to overwrite an existing file with a read-only attribute

+4
source

Apparently you are trying to execute a file that moves to another location ... I think this will not work.

0
source

Can you copy files opened in Windows? I have undefined memory that you cannot, and the file will be opened during its execution.

Is this really being copied? It does not exist there before copying? Did he copy the whole file?

0
source

Source: https://habr.com/ru/post/1335835/


All Articles