'The specified device is not open or is not recognized by MCI

I was programming a game using Python and a sound effect needed to be played, so I used the playsound module:

from playsound import playsound

playsound("Typing.wav", False)

And when I attempted the run the program this error was returned:

Error 263 for command:
        open Typing.wav
    The specified device is not open or is not recognized by MCI.

I did some research and some sources indicated that it was an issue with my sound drivers. I updated & reinstalled it, but the issue persists. Is there any way to solve this?



Solution 1:[1]

I faced this problem too firstly as mentioned in the previous comments I downgraded my python version from 3.10 to 3.7 and yet the problem persisted. So what actually worked is that the recent versions of playsound are giving such errors in order to fix this run the following commands in cmd as admin

pip uninstall playsound

pip install playsound==1.2.2

and this should do the work.

just in case that doesn't work try degrading your python version to 3.7 and run these commands and that should be good.

Solution 2:[2]

Try downgrading to Python 3.7 or 3.8

I had successfully used playsound in a project several months ago, but upon revisiting it today with a Python 3.9 virtual environment I ran into the same error as the OP. Downgrading to either a Python 3.7 or 3.8 venv fixed things right up.

I know this feels like a cheap answer, and I don't like it either, especially since playsound's CI system explicitly does a build for Python 3.9 on Windows, Linux, and Mac. If someone else has more insight into why playsound doesn't seem to work in Python >3.8 I'd love to hear it!

Solution 3:[3]

I had this same problem and fixed it using

audio_file = os.path.dirname(__file__) + 'audio.mp3'
playsound(audio_file)

Solution 4:[4]

I don't think PlaySound supports .wav files. Try converting Typing.wav into an mp3 file. Then change

playsound("Typing.wav", False)

Into

playsound("Typing.mp3", False)

Solution 5:[5]

Please see my answer here: The problem is in the way playsound() handles file paths. It expects a full path name using forward slashes only. Wish it becomes more portable in subsequent releases.

Solution 6:[6]

This worked for me:

from pathlib import Path

from playsound import playsound

audio = Path().cwd() / "audio.mp3"
playsound(audio)

Solution 7:[7]

Just use playsound2 instead. Everything's the same except this library is not buggy.

Solution 8:[8]

**Command run as administrator

  1. pip uninstall playsound
  2. pip install playsound==1.2.2

**terminal in Pycharm

  1. pip uninstall playsound
  2. pip install playsound==1.2.2

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
Solution 2
Solution 3 Simas Joneliunas
Solution 4 martineau
Solution 5 Raja
Solution 6 clamytoe
Solution 7 eLeMeNOhPi
Solution 8