首页 > 解决方案 > PermissionError:[错误 13] 权限被拒绝:scr.png

问题描述

我制作了一个用于截屏的 exe 文件(用 pyhon3 编码)。我的 exe 文件正在运行。现在我将我的exe文件添加到启动使用subprocess.call(r'REG ADD "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /V "takescreenshoot" /t REG_SZ /F /D "' + location + '"', shell=True)但是当我重新启动我的电脑然后在启动时我得到错误

““<code>site-packages\PIL\image.py”,第 2131 行,保存中...PermissionError:[错误 13] 权限被拒绝:scr.png “

一段代码是:

snapshot = ImageGrab.grab()

    # Using png because it cannot write mode RGBA as JPEG
    file = "scr.png"
    snapshot.save(file)

标签: pythonpython-3.xpython-2.7subprocess

解决方案


推荐阅读