2
I was touching the Pygame
and when performing a program that plays music:
from pygame import mixer
mixer.init()
mixer.music.load('ex021.mp3') # Dark Souls III Soundtrack OST - Main Theme.mp3
mixer.music.play()
input()
It returns me the following error:
Exception has occurred: pygame.error
Couldn't open 'ex021.mp3'
File "/home/alanmaxwell/Documentos/Projects/VS Code/curso-python3/Mundo 01: Fundamentos/ex021.py", line 8, in <module>
mixer.music.load('ex021.mp3') # Música - Dark Souls III Soundtrack OST - Main Theme.mp3
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/lib/python3.7/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
ONLY in VS Code, in other Ide’s like Pycharm for example, it runs normally. Someone knows what might be?
OBS: I installed Pygame normally in the virtual environment and the.mp3 file is in the same folder as the.py file, I tried using the mixer.load()
both with the file name, and stating the path.
Your error photo missed the most important line, the last one! Please edit the question and add the rest of the error. Also, put it in text format, not image format.
– nosklo
@nosklo Ready, the error is in text mode, but the error lines were only those of the same photo, no more.
– Alan Maxwell