'Error 259 on python playsound() unable to sound
I Saw this question here. But my file is already in wav. My code is a timer which plays sound after timer ends using threading. It wasn't working there, then I tried it in different file which just had the file and library:
from playsound import playsound
playsound('alarm.wav')
When I do this following error occurs:
Error 259 for command:
play alarm.wav wait
The driver cannot recognize the specified command parameter.
Traceback (most recent call last)
...
playsound.PlaysoundException:
Error 259 for command:
play alarm.wav wait
The driver cannot recognize the specified command parameter.
But when I give the path:
from playsound import playsound
playsound('path/to/alarm.wav')
the following error occurs in a pop box (SyntaxError):
(unicode error)some stuff after that
I'm on Windows and I tried it on IDLE and by double clicking the file (Python3.7.3).
If it helps, it works on a different device (both have same Python versions).
Solution 1:[1]
I try to use code:
playsound(u"path/to/alarm.wav")
and it works well for me (python 3.9.5, playsound 1.3.0, windows 11 platform)
Solution 2:[2]
Run this in CMD or any such terminal:
pip install playsound==1.2.2
Downgrading the version works perfectly for me :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | math girl 796 |
Solution 2 | Itchydon |