I need to load loads of images that are in a file, of which is in the same file as the .py file, but I keep getting this error: pygame.error: Couldn't open C:\Users\USER\Desktop\tester\animals
Here is my code:
import os
firstpath = str(os.path.dirname(os.path.abspath(__file__)))
I need to be able to access this sub file wherever itself and my script is.
def load_images():
animal_dict = {}
path = (firstpath+"\animals")
animal = os.listdir(path)
for images in animal:
if images.endswith(".png"):
path = os.path.join(path)
key = images[:-4]
animal_dict[key] = pygame.image.load(path).convert()
return country_dict
load_images()