I bet your current working directory isn't what you think it is. Try:
import os
os.getcwd()
Make sure that directory (printed by os.getcwd()
) has your image in it (i.e. go to that folder and check to see if your image is there). If not, specify the absolute path to your image:
path = C:/Users/<user_name>/... .../krebs.jpg
or whatever the full path to the image is on your OS.
Alternatively, you could move the image to the folder indicated by os.getcwd()
.
Sometimes I make a typo when defining paths in python, because very simple IDEs (like IDLE) don't have in-line auto-complete. Here's a trick I use all the time to make sure my absolute path doesn't have a typo:
import tkinter.filedialog as fd
path = fd.askopenfilename()
It will open a familiar file opening dialog. Use the file dialog window to find your file, then click "Open", and you'll have the full path saved to variable "path".