Nov-28-2020, 09:09 PM
I started following a Space Invaders tutorial for pygame, and I made sprites in Piskel and put them into the folder with my game, but I got an error saying "FileNotFoundError: No such file or directory." Note that I am very new to pygame. I tried many ways, but it still comes up with the same error, which are listed below.
- pygame.image.load("cannon.png")
- pygame.image.load("cannon.gif")
- pygame.image.load("\Users\ZULU\AppData\Local\Programs\Python\Python37-32\Zion_Python Games\First Pygame\cannon.png")
- pygame.image.load("/Users/ZULU\AppData/Local/Programs/Python/Python37-32/Zion_Python Games/First Pygame/cannon.png")
- pygame.image.load(os.path.abspath("cannon.png"))
- pygame.image.load(os.path.abspath("\Users\ZULU\AppData\Local\Programs\Python\Python37-32\Zion_Python Games\First Pygame\cannon.png"))
Also, I tried checking if the path existed, but It always appeared False.
os.path.exists('/Users/ZULU/AppData/Local/Programs/Python/Python37-32/Zion_Python Games/First Pygame/cannon.png')
I'm just not sure what to do.
- pygame.image.load("cannon.png")
- pygame.image.load("cannon.gif")
- pygame.image.load("\Users\ZULU\AppData\Local\Programs\Python\Python37-32\Zion_Python Games\First Pygame\cannon.png")
- pygame.image.load("/Users/ZULU\AppData/Local/Programs/Python/Python37-32/Zion_Python Games/First Pygame/cannon.png")
- pygame.image.load(os.path.abspath("cannon.png"))
- pygame.image.load(os.path.abspath("\Users\ZULU\AppData\Local\Programs\Python\Python37-32\Zion_Python Games\First Pygame\cannon.png"))
Also, I tried checking if the path existed, but It always appeared False.
os.path.exists('/Users/ZULU/AppData/Local/Programs/Python/Python37-32/Zion_Python Games/First Pygame/cannon.png')
I'm just not sure what to do.