【发布时间】:2021-11-02 01:29:48
【问题描述】:
我正在尝试在 Python 中截取屏幕截图并尝试保存图像,但它给了我一个错误
这是代码:
import pyautogui as pygui
def take_screenshot():
ss = pygui.screenshot()
cd = os.getcwd()
ss.save(cd+"/Data/Screenshots/Screenshot.png")
这是错误代码:
File "Main.py", line 67, in <module>
scan_func()
File "Main.py", line 53, in scan_func
take_screenshot()
File "/home/user/IXL-Bot/Data/ExternalModules/ScreenshotModules.py", line 7, in take_screenshot
ss.save(cd+"/Data/Screenshots/Screenshot.png")
File "/home/user/.local/lib/python3.7/site-packages/PIL/Image.py", line 2232, in save
fp = builtins.open(filename, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/IXL-Bot/Data/Screenshots/Screenshot.png'
【问题讨论】:
标签: python python-3.x screenshot pyautogui