Here's my code:
import colorgram
import turtle
colors = colorgram.extract("color.jpg", 30)
color_list = []
for object in colors:
color = object.rgb
red = color.r
green = color.g
blue = color.b
color_list.append((red, green, blue))
tim = turtle.Turtle()
screen = turtle.Screen()
screen.setworldcoordinates(-1, -1, screen.window_width()-1, screen.window_height()-1)
screen.exitonclick()
Error:
(venv) ➜ PythonProgramming git:(main) ✗ /Users/wenzexu/Documents/GitHub/PythonProgramming/venv/bin/python /Users/wenzexu/Documents/GitHub/PythonProgramming/day-18-turt
le/main.py
Traceback (most recent call last):
File "/Users/wenzexu/Documents/GitHub/PythonProgramming/day-18-turtle/main.py", line 4, in <module>
colors = colorgram.extract("color.jpg", 30)
File "/Users/wenzexu/Documents/GitHub/PythonProgramming/venv/lib/python3.9/site-packages/colorgram/colorgram.py", line 38, in extract
image = f if isinstance(f, Image.Image) else Image.open(f)
File "/Users/wenzexu/Documents/GitHub/PythonProgramming/venv/lib/python3.9/site-packages/PIL/Image.py", line 3218, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'color.jpg'
I want to extract colors from this 'color.jpg', but in the VSCode terminal I got an error: no such file or directory
. I have checked my file name, nothing wrong. So what should I supposed to do?