Image won’t save Python pyautogui

I’m trying to take a screenshot in Python and I’m trying to save the image, but it gives me an error

This is the code:

import pyautogui as pygui

def take_screenshot():
    ss = pygui.screenshot()
    cd = os.getcwd()"/Data/Screenshots/Screenshot.png")

This is the error code:

  File "", line 67, in <module>
  File "", line 53, in scan_func
  File "/home/user/IXL-Bot/Data/ExternalModules/", line 7, in take_screenshot"/Data/Screenshots/Screenshot.png")
  File "/home/user/.local/lib/python3.7/site-packages/PIL/", line 2232, in save
    fp =, "w+b")
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/IXL-Bot/Data/Screenshots/Screenshot.png'


When edited the code slightly, it worked perfectly for me.

Try This:

import pyautogui as pygui
import os  #You dont seem to have included this in your example code

def take_screenshot():
    ss = pygui.screenshot()
    cd = os.getcwd()
    print(cd+/Data/Screenshots/Screenshot.png) #Check if the path it 
                                               #specifying is correct"/Data/Screenshots/Screenshot.png")