10

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.
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Rohit Dutta
  • 105
  • 1
  • 1
  • 4
  • Please take the [tour] and carefully read through the [help] to learn more about the site, including [what is on-topic](https://stackoverflow.com/help/on-topic) and [what is not](https://stackoverflow.com/help/dont-ask), as well as [ask]. Please also follow the [question checklist](https://meta.stackoverflow.com/q/260648). – MattDMo Aug 08 '21 at 20:23
  • "I don't know how to ask questions on StackOverflow" Then you should read [ask]. Anyway, Stack Overflow is not tech support. If you think the problem is in your code, you need to show us the code. If you think the problem is with the library, then you need to try using the issue tracker for that project instead. If you think the problem is your computer's configuration, then you should try https://superuser.com. But in every case you should start by searching the Internet and reading the documentation. – Karl Knechtel Aug 08 '21 at 20:26
  • Ok Sir, I try to resolve it. Thank You. – Rohit Dutta Aug 09 '21 at 13:27

4 Answers4

22

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.

RHP_Rishad
  • 221
  • 1
  • 3
14

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. '''

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
3

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.

Aditya101
  • 31
  • 1
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 07 '21 at 20:33
0

I had the same problem with the latest version. Downgrading to 1.2 worked for me:

pip install playsound==1.2.2
Julia Meshcheryakova
  • 3,162
  • 3
  • 22
  • 42
Stefan
  • 1
  • 2