lemongrass
lemongrass

Reputation: 17

os unable to load image pygame.error: Couldn't open imgs\pipe.png

source code : https://github.com/techwithtim/NEAT-Flappy-Bird line 28 - 31 (tech with tims flappy bird deep learning ai)

pipe_img = pygame.transform.scale2x(pygame.image.load(os.path.join("imgs","pipe.png")).convert_alpha())
bg_img = pygame.transform.scale(pygame.image.load(os.path.join("imgs","bg.png")).convert_alpha(), (600, 900))
bird_images = [pygame.transform.scale2x(pygame.image.load(os.path.join("imgs","bird" + str(x) + ".png"))) for x in range(1,4)]
base_img = pygame.transform.scale2x(pygame.image.load(os.path.join("imgs","base.png")).convert_alpha())

i at first thought it was a local problem but after fiddling with python and uninstalling installing and reinstalling it i can conclude it is almost certainly not that.

here's the error:

Traceback (most recent call last):
  File "c:/Users/osty2/Documents/programing_projects/NEAT-Flappy-Bird/flappy_bird.py", line 28, in <module>
    pipe_img = pygame.transform.scale2x(pygame.image.load(os.path.join("imgs","pipe.png")).convert_alpha())
pygame.error: Couldn't open imgs\pipe.png
PS C:\Users\osty2\Documents\programing_projects> 

its an os error but everything that i've tried doesn't work.everything in the requirements folder is installed, everything is run on 3.8.6 and was also tested on 3.7.2, 3.7.9 and 3.9.0.

issue submitted in github

issue submitted to reddit

picture of an images folder thats there

Upvotes: 0

Views: 281

Answers (1)

Brennan
Brennan

Reputation: 514

The error has nothing to do with your version of python and it's not an issue with the repo. From what I can tell, you are trying to run the app from C:\Users\osty2\Documents\programing_projects, which has no imgs folder.

Navigate to C:\Users\osty2\Documents\programing_projects\NEAT-flappy-bird and then run it. The application will then be able to see the imgs folder.

Upvotes: 2

Related Questions