Python弹奏模块“驱动程序无法识别指定的命令参数。”

发布于 2025-02-09 07:55:13 字数 1407 浏览 1 评论 0原文

这是我正在运行的代码:

from playsound import playsound
import threading
threading.Thread(target=playsound, args=('Assets\Loss.mp3',)).start()

当我运行此问题时,会给我这个错误,

    Error 259 for command:
        play "Assets\Loss.mp3" wait
    The driver cannot recognize the specified command parameter.

    Error 305 for command:
        close "Assets\Loss.mp3"
    Cannot specify extra characters after a string enclosed in quotation marks.
Failed to close the file: "Assets\Loss.mp3"
Traceback (most recent call last):
  File "C:\Users\ekila\Downloads\Smart Auto Bet\Test.py", line 10, in <module>
    playsound('Assets\Loss.mp3')
  File "C:\Python310\lib\site-packages\playsound.py", line 73, in _playsoundWin
    winCommand(u'play {}{}'.format(sound, ' wait' if block else ''))
  File "C:\Python310\lib\site-packages\playsound.py", line 64, in winCommand
    raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException: 
    Error 259 for command:
        play "Assets\Loss.mp3" wait
    The driver cannot recognize the specified command parameter.

这更感兴趣的是,当我将mp3移至同一文件夹并运行时,

from playsound import playsound
import threading
threading.Thread(target=playsound, args=('Loss.mp3',)).start()

它的效果很好,没有错误,但我想拥有mp3存储在子目录中,

  • 我已经安装了1.2.2版。
  • 我尝试过不穿线运行它

Heres the code I'm running:

from playsound import playsound
import threading
threading.Thread(target=playsound, args=('Assets\Loss.mp3',)).start()

When I run this it gives me this error

    Error 259 for command:
        play "Assets\Loss.mp3" wait
    The driver cannot recognize the specified command parameter.

    Error 305 for command:
        close "Assets\Loss.mp3"
    Cannot specify extra characters after a string enclosed in quotation marks.
Failed to close the file: "Assets\Loss.mp3"
Traceback (most recent call last):
  File "C:\Users\ekila\Downloads\Smart Auto Bet\Test.py", line 10, in <module>
    playsound('Assets\Loss.mp3')
  File "C:\Python310\lib\site-packages\playsound.py", line 73, in _playsoundWin
    winCommand(u'play {}{}'.format(sound, ' wait' if block else ''))
  File "C:\Python310\lib\site-packages\playsound.py", line 64, in winCommand
    raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException: 
    Error 259 for command:
        play "Assets\Loss.mp3" wait
    The driver cannot recognize the specified command parameter.

What's a little bit more interested is that when I move the mp3 to the same folder and run

from playsound import playsound
import threading
threading.Thread(target=playsound, args=('Loss.mp3',)).start()

It plays perfectly fine with no errors but I want to have the mp3 stored in the subdirectory

  • I have playsound version 1.2.2 installed.
  • I've tried running it without threading

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文