Pygame uploading file images

hi I am learning pygame please.I am using windows computer.Please I want to upload images from
I have downloaded them for my game.Please see the error that comes in my pygame.Please help me with this.
Many thanks

hi, please see the codes that i have written in IDLE shell of pygame…many thanks

I’d try checking your img_dir variable. Kinda seems like it might be pointing to the image file ship1.jpg rather than the folder project1.
The path it’s trying to open refers to the JPG twice: ...\Documents\project1\ship1.jpg\ship1.jpg

1 Like

4 error3

hi please have a look.I have changed it but its still the same thing…please help!

It looks like you’re repeating project1 as part of your path.

Perhaps you just want img_dir = path.dirname(__file__) instead. What does your directory structure look like?

hi, when i write the code as you have said…after running the code it says invalid syntax.please see as attached.syntax

You’re missing a parenthesis, but you no longer need the path.join. Just write it as

img_dir = path.dirname(__file__)

That is, assuming your images do actually live one directory up from where your file is – I don’t know what your directory structure looks like.

I have saved the image i am trying to upload with the name as above