Hi,
How do you know this in your code?
You have to check it :
https://docs.opencv.org/4.x/db/deb/tutorial_display_image.html
import cv2 as cv
import sys
img = cv.imread("starry_night.jpg")
if img is None:
sys.exit("Could not read the image.")