开发者

"IOError [Errno 13] Permisson denied" when copy a file on Windows

I wrote a program that will copy a file called a.exe to C:/Windows/, then I pack it to exe with PyInstaller, and rename the exe file to a.exe. When I run the exe file, it output IOError [Errno 13] Permisson denied: 'C:/Windows/a.exe', but the file a.exe was copied to the directory C:/Windows. Then I ran it as the Administrator, it happened again... At first, I copy the file with shututil.copy, then I wrote a function myself(open a.exe, create a.exe under C:/Windows, read a.exe 's content and write to C:/Windows/a.exe, close all), but it doesn't help...Any ide开发者_StackOverflow中文版as?


Check if a.exe has read-only attribute. shutil.copy raises "Permission denied" error when it is called to overwrite existing file with read-only attribute set


Apparently you're trying to execute a file that moves itself to a different place ... I guess that cannot work.


Can you copy files that are open in Windows? I have a vague memory that you can't, and the file will be open while you execute it.

Is it really being copied? It doesn't exist there before copying? Did it copy the whole file?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜