0

I keep getting error 277 : a problem occurred in initializing MCI. when using playsound module. I basically just did this:

from playsound import playsound

playsound('what.mp3')

the what.mp3 is generated using gtts.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Hoshi
  • 1
  • 1
  • 4
  • Does this answer your question? ["A problem occurred in initializing MCI" playsound issues](https://stackoverflow.com/questions/56627901/a-problem-occurred-in-initializing-mci-playsound-issues) – Tomerikoo Oct 10 '21 at 09:56

6 Answers6

2

I know this is too late but try to install Klite Codec Pack and try again, worked for me

Teddie Bui
  • 21
  • 3
0

I just solved the same issue using playsound by doing 2 steps:

  1. I re-encoded the .mp3 with Audacity because the files that i downloaded from a webconverter was trashy. (still not working)

  2. I added the True value at the end, like this:

     from playsound import playsound
     playsound('/path/to/a/sound/file/you/want/to/play.mp3, True')
    

Then it worked. I hope it's helpful.

0

You can try this approach

from playsound import playsound
playsound('C:\\Users\\shubham sinha\\Desktop\\code\\01RitvizLiggiOfficialMusicVideoRingtone.mp3')
Simas Joneliunas
  • 2,890
  • 20
  • 28
  • 35
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 14 '22 at 08:48
-1

Try using this test code to see if it works:

from playsound import playsound
playsound('/path/to/a/sound/file/you/want/to/play.mp3')

If it doesn't install it again or try another version of python.

1010011010
  • 45
  • 1
  • 1
  • 12
  • Hi I tried adding path but same error. I also tried going from 3.7.4 to 3.7.2 but same error. I also did pip uninstall playaudio then install again but same error =(. – Hoshi Nov 23 '19 at 14:32
  • Oh, then I son't really know what to do, sorry :( – 1010011010 Nov 24 '19 at 12:49
-1

you should write like this:

from playsound import playsound
playsound('C:\\Users\\Talha Shafiq Chadhry\\Downloads\\Video')
JLeno46
  • 1,186
  • 2
  • 14
  • 29
-1

I used to get this error, Now solved... Try this one

import playsound
playsound.playsound("D:\\Yalgaar.mp3")

Here Yalgaar is saved in my D drive