I'm trying to make an alarm clock, and it works for the most part. But I installed playsound so I could make it play music when it goes off as an alarm clock should. I'm not quite sure how to use paths and even when I place the .wav in the folder it's meant to be it doesn't play. Code:
import datetime
from playsound import playsound
alarmHour = int(input("What hour do you want to wake up?"))
alarmMinute = int(input("What minute do you want?"))
amPm = str(input("Am or Pm")).lower().strip()
if (amPm == "pm"):
alarmHour = alarmHour + 12
while(1 == 1):
if(alarmHour == datetime.datetime.now().hour and
alarmMinute == datetime.datetime.now().minute):
print("Wake up, lazy!")
playsound("C:\\Users\\wicke\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\site-packages\\askaway.wav")
break
print("Exited")
The error:
Error 275 for command:
open "C:\Users\jeandae\AppData\Local\Programs\Python\Python39\Lib\site-packages\askaway.wav"
Cannot find the specified file. Make sure the path and filename are correct.
Error 263 for command:
close "C:\Users\jeandae\AppData\Local\Programs\Python\Python39\Lib\site-packages\askaway.wav"
The specified device is not open or is not recognized by MCI.
Failed to close the file: "C:\Users\jeandae\AppData\Local\Programs\Python\Python39\Lib\site-packages\askaway.wav"
Traceback (most recent call last):
File "C:/Users/jeandae/AppData/Local/Programs/Python/Python39/alarm 2.py", line 16, in <module>
playsound("C:\\Users\\jeandae\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\site-packages\\askaway.wav")
File "C:\Users\jeandae\AppData\Local\Programs\Python\Python39\lib\site-packages\playsound.py", line 72, in _playsoundWin
winCommand(u'open {}'.format(sound))
File "C:\Users\jeandae\AppData\Local\Programs\Python\Python39\lib\site-packages\playsound.py", line 64, in winCommand
raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException:
Error 275 for command:
open "C:\Users\jeandae\AppData\Local\Programs\Python\Python39\Lib\site-packages\askaway.wav"
Cannot find the specified file. Make sure the path and filename are correct.