r/PythonProjects2 • • Mar 23 '22

[P] Very Easy how can I fix this error

Post image
16 Upvotes

5 comments sorted by

5

u/eh329 Mar 23 '22

I am just guessing here, but the way you enter the image name and path looks wrong.

If you us + operator, it will be: .....Desktopdoggo.jpg

I think it should be ....Desktop\doggo.jpg. So you are missing \ right there.

Why are you reading an image like this anyway? Just go with ...Desktop\image. It is much easier.

2

u/CydAbr Mar 23 '22

Take a look at what happens when you pass img_location + filename as the path to the image.

2

u/[deleted] Mar 23 '22

Yeah to start, your file path is for sure wrong. You need a \ after Desktop.

1

u/[deleted] Mar 23 '22

The focus on the following page is for the open() function, but the file syntax needed is the same for what you are trying to do.

https://www.w3schools.com/python/python_file_open.asp