myfile = open('kill.txt', encoding='utf-8').readlines() NoiseMP3 = myfile[3] bop = pygame.mixer.music.load(NoiseMP3) pygame.mixer.music.play(-1)
Simply, the name of the file is on line 3. The file is there and works if i change NoiseMP3 to the file name.
i get back
Traceback (most recent call last): File "C:UsersSamDesktopいち sufferingWordsWords.py", line 66, in <module> bop = pygame.mixer.music.load(NoiseMP3) pygame.error: Couldn't open 'wear.mp3 '
Looks like you are not dealing with the line return at the end of the line. Try:
NoiseMP3 = myfile[3].strip()
1.4m articles
1.4m replys
5 comments
56.9k users