0

the imgs won't load from a subfolder. Whats weird is that even when the images are right beside the main code in the main folder it still does not work

background = pygame.image.load("img/road.png").convert()

guy = pygame.image.load("img/idle.png").convert()
guy.set_colorkey(WHITE)

zombie = pygame.image.load("img/zombie.png").convert()
zombie.set_colorkey(GREEN)

The error message:

Traceback (most recent call last): File "c:/Users/tcric/Documents/code/game_jam.py", line 41, in <module> background = pygame.image.load("img/road.png").convert() 
pygame.error: Couldn't open img/road.png
Cribber
  • 2,513
  • 2
  • 21
  • 60
IDK
  • 1
  • 1
    Any error messages? (Add them to the question.) – DYZ Oct 14 '20 at 21:44
  • Traceback (most recent call last): File "c:/Users/tcric/Documents/code/game_jam.py", line 41, in background = pygame.image.load("img/road.png").convert() pygame.error: Couldn't open img/road.png – IDK Oct 14 '20 at 22:53
  • You run the program in a folder that does not have `"img/road.png"`. – DYZ Oct 14 '20 at 23:07
  • 1
    Does this answer your question? [Python can't open file "No such file or directory"](https://stackoverflow.com/questions/45636411/python-cant-open-file-no-such-file-or-directory) – DYZ Oct 14 '20 at 23:08

0 Answers0