Error 259 for command:
play sound/zhou.mp3 wait
驱动程序无法识别指定的命令参数。
Error 263 for command:
close sound/zhou.mp3
指定的设备未打开,或不被 MCI 所识别。
Failed to close the file: sound/zhou.mp3
Traceback (most recent call last):
File "order2.py", line 151, in <module>
playsound('sound/zhou.mp3')
File "playsound.py", line 73, in _playsoundWin
File "playsound.py", line 64, in winCommand
playsound.PlaysoundException:
Error 259 for command:
play sound/zhou.mp3 wait
驱动程序无法识别指定的命令参数。
[7404] Failed to execute script 'order2' due to unhandled exception!
查阅了很多资料后发现,在windows不支持utf-16编码,需要修改playsound源码
路径:C:\Users\Jason\AppData\Local\Programs\Python\Python310\Lib\site-packages>playsound.py,要根据你安装的路径来。
需要修改两个地方
# def winCommand 方法下
- command = ' '.join(command).decode('utf-16')
+ command = ' '.join(command)
exceptionMessage = ('\n Error ' + str(errorCode) + ' for command:'
- '\n ' + command.decode('utf-16') +
+ '\n ' + command +
'\n ' + errorBuffer.raw.decode('utf-16').rstrip('\0'))
在执行程序就可以了。
如果之前有用pyinstaller 生成.exe文件。也需要重新编译才可以用哦!
|