使用playsound +操作系统路径时出现错误python

时间:2020-08-22 03:53:14

标签: python os.path playsound

我在游戏中使用此行

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.

1 个答案:

答案 0 :(得分:0)

您是否检查了命令提示符或文件资源管理器中是否存在该文件。文件在您期望的文件夹中吗?