python - 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)
解决方案
推荐阅读
- json - Spring Boot JSON 过滤器
- lambda - 使用python 2.7使用lambda函数停止AWS极光数据库
- c# - Android Unity 中语音命令的调用函数
- json - 管理来自服务器的响应类型
- cucumber-jvm - 我可以在黄瓜 Java 中运行/使用 3 个带有单步定义文件的功能文件吗
- java - 需要复制构造函数说明
- apache-kafka - 一位消费者宕机/崩溃时的 Kafka 消费者行为
- facebook - 是否可以将一个聊天机器人中的 user_id 与其他聊天应用程序一起使用?
- c++ - 为什么即使在包含 math.h 并使用 -lm 链接到数学库之后我也会收到“未定义的符号:.sqrtf”
- php - 从数据库表php mysql中获取数据时如何忽略空值