I was making a program that plays a song from playsound but I got the error:"UnicodeDecodeError:'t decode byte 0xe3 at position 1: invalid continuation byte" What to do to play the song.
This was my code:
from playsound import playsound
playsound('C://Users//hp//Desktop//francisco//non-school work//musica.mp3')
This was the error:
Traceback (most recent call last):
File "c:/Users/hp/Desktop/francisco/trabalhos que não são da escola/projeto1/ex021.py", line 3, in <module>
playsound('C:/Users/hp/Desktop/francisco/trabalhos que não são da escola/musica.mp3')
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\playsound.py", line 35, in _playsoundWin
winCommand('open "' + sound + '" alias', alias)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\playsound.py", line 30, in winCommand
'\n ' + errorBuffer.value.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 1: invalid continuation byte
I tried to remove double slashes and shows another error:
from playsound import playsound
playsound('C:\Users\hp\Desktop\francisco\trabalhos que não são da escola\musica.mp3')
input()
The error:
File "c:/Users/hp/Desktop/francisco/trabalhos que não são da escola/projeto1/ex021.py", line 3
playsound('C:\Users\hp\Desktop\francisco\trabalhos que não são da escola\musica.mp3')
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
I already solved the problem just doing this:
from playsound import playsound
playsound('musica.mp3')
input()
What was the problem???