Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spaceship
#11
What does your file structure look like? For example, what is your root file to start the program, is in what directory as opposed to the image locations?

Would be easier to view on Github where we can easily see this fike structure
Recommended Tutorials:
Reply
#12
Here is the link for the Github Repo

https://github.com/abscorpy/Spaceship

Cheers
Reply
#13
(Jul-26-2021, 07:15 AM)abscorpy Wrote: Here is the link for the Github Repo

https://github.com/abscorpy/Spaceship

Cheers

If the file structure looks like this then pygame.image.load('spaceship_yellow.png') should work. When doing pygame.image.load(os.path.join('First_Game', 'spaceship_yellow.png')) Python is looking for a directory named First_Game within the root directory, or directory the main python file is running from. Since there is no such directory within the root directory, it throws an error.
Reply
#14
Thanks
(Aug-06-2021, 07:53 PM)SheeppOSU Wrote:
(Jul-26-2021, 07:15 AM)abscorpy Wrote: Here is the link for the Github Repo

https://github.com/abscorpy/Spaceship

Cheers

If the file structure looks like this then pygame.image.load('spaceship_yellow.png') should work. When doing pygame.image.load(os.path.join('First_Game', 'spaceship_yellow.png')) Python is looking for a directory named First_Game within the root directory, or directory the main python file is running from. Since there is no such directory within the root directory, it throws an error.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020