Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
749 views
in Technique[技术] by (71.8m points)

python - 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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...