This is a small section of my pygame code. I am trying to get a random Image to be loaded. In the text file I have 10 different paths to different images.
random_number = random.randint(0,9)
file = open('ImagePath.txt','r')
paths = file.readlines()
path = paths[random_number]
Img = pygame.image.load(path)
Display.blit(Img, (20,20))
When I run the code it says the image cannot be accessed and that the error is found on the line:
Img = pygame.image.load(path)