【发布时间】:2021-10-10 17:05:28
【问题描述】:
我将这条线用于我的游戏
playsound(os.path.join(os.path.dirname(__file__) , 'asset', C1 + '.mp3'))
它在 linux 上运行良好,但在 windows 上我得到输出:
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 275 for command:
open "E:\test\asset\sound3.mp3" alias playsound_0.4871568054138944
Cannot find the specified file. Make sure the path and filename are correct
当我输入完整路径时
Error 277 for command:
open "E:\JPssetound3.mp3" alias playsound_0.511238440569949
A problem occurred in initializing MCI.
【问题讨论】:
-
硬编码路径是否有效?
-
尝试转换为 wav 文件并检查是否可以播放。