Playsound not playing music

158 Views Asked by At

i tried to play a music file but failed

from playsound import playsound
playsound('play.mp3')

but it shows the error

Error 277 for command:
    open play.mp3
A problem occurred in initializing MCI

also tried this before

from playsound import playsound
playsound('C:\\Users\\Usman\\Music\\My music//play.mp3') 

but this error showed up

Traceback (most recent call last):
File "c:\Users\Usman\Downloads\Python Course with Notes\1. Chapter 1\01-prob3.py", line 2, in 
<module>
playsound('C:\\Users\\Usman\\Music\\My music//play.mp3')
File "C:\Users\Usman\AppData\Local\Programs\Python\Python310\lib\site-packages\playsound.py", 
line 41, in _playsoundWin
copy(sound, tempPath)
File "C:\Users\Usman\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 417, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Users\Usman\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 254, in 
copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Usman\\Music\\My 
music//play.mp3'
PS C:\Users\Usman\Downloads\Python Course with Notes\1. Chapter 1>

first one enter image description here enter image description here

second one enter image description here the path: enter image description here

what am i doing wrong? pls help

0

There are 0 best solutions below