Reputation: 11
I'm trying to use the python image library to import an image. I keep getting an error that says the file or directory doesn't exist when I run this code:
from PIL import Image
img = Image.open("Users/tylercordeiro/hello/sunrisesunsettime.jpeg")
Am I doing anything wrong? Is there a specific way that I need to put in the name of my file/directory?
Upvotes: 1
Views: 41
Reputation: 677
Try with an absolute path. I have added a /
or slash
at the beginning of the file name.
from PIL import Image
im = Image.open("/Users/tylercordeiro/hello/sunrisesunsettime.jpeg")
im
Upvotes: 1