Python Playsound Error 261 for command: The driver cannot recognize the specified command

Viewed 10975

Please help to solve this error:

>>> from playsound import playsound
>>> playsound('C:\\Users\\Rohit\\Desktop\\Python\\file.mp3')

Result from Terminal:

PS C:\Users\Rohit\Desktop\Python> & C:/Users/Rohit/AppData/Local/Programs/Python/Python38/python.exe c:/Users/Rohit/Desktop/Python/2Python.py

    Error 261 for command:

        open "C:\Users\Rohit\Desktop\Python\file.mp3"

    The driver cannot recognize the specified command.

    Error 261 for command:

        close "C:\Users\Rohit\Desktop\Python\file.mp3"

    The driver cannot recognize the specified command.

Failed to close the file:

 "C:\Users\Rohit\Desktop\Python\file.mp3"

Traceback (most recent call last):
  File "c:/Users/Rohit/Desktop/Python/2Python.py", line 3, in <module>
    playsound('C:\\Users\\Rohit\\Desktop\\Python\\file.mp3')
  File "C:\Users\Rohit\AppData\Local\Programs\Python\Python38\lib\site-packages\playsound.py", line 72, in _playsoundWin
   winCommand(u'open {}'.format(sound)) 
File "C:\Users\Rohit\AppData\Local\Programs\Python\Python38\lib\site-packages\playsound.py", line 64, in winCommand
    raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
  
Error 261 for command:
        
        open "C:\Users\Rohit\Desktop\Python\file.mp3"
     
   The driver cannot recognize the specified command.
3 Answers

I was using playsound version = 1.3.0 | With this version i have found same error like you. For solution you have to downgrade your playsound version. For this you have to first uninstall your playsound module by this code...pip uninstall playsound then press "y" to proceed . Then install the old and pure version of playsound by this command... pip install playsound==1.2.2 and then try to execute your code.It will work.

Use

pip install playsound==1.2.2 

it works great.

>>> from playsound import playsound

>>> playsound('C:\\Users\hvars\Downloads\\tiktok.mp3')

Note:- plz avoid using ''' playsound==1.3.0 '''

It will generate error like this ''' The driver cannot recognize the specified command parameter. '''

Open the terminal and just uninstall playsound by pip uninstall playsound and then just install the more stable version of playsound pip install playsound==1.2.2 by this the problem must be solved.

Related