我的代码是一个自动通知系统。我与我的代码一起使用的音频文件与 Python 文件位于同一目录中。但是当我运行代码时,playsound
说找不到文件。
import schedule
import time
from playsound import playsound
#define functions
def g_assembly():
#play sound when function is called
playsound("trialvoice.mp3")
def greet():
playsound("trialvoice.mp3")
#initiate schedule
schedule.every().friday.at('15:55').do(g_assembly)
schedule.every().friday.at('15:56').do(greet)
#keep schedule running
while True:
schedule.run_pending()
time.sleep(1)
这是下面的错误:
Error 275 for command:
open "trialvoice.mp3" alias playsound_0.9746097500934046
Cannot find the specified file. Make sure the path and filename are correct.
Process finished with exit code 1