Everything of the program works when I ask pycharm to run it.
yet when I ask my raspberry Pi to run it, it skips the EndTimer
. so the song keeps on playing. On windows the song would stop. What could make this little diffrence?
import datetime
import pygame
def Clockupdate(time):
Timer = "21:56:00"
EndTimer = '21:56:20'
if time == Timer:
playsound()
if time == EndTimer:
global a
a = False
def secondrefresher():
newtime = ""
oldtime = datetime.datetime.now()
a = str(oldtime.hour)
b = str(oldtime.minute)
c = str(oldtime.second)
if int(c) < 10:
c = "0"+str(c)
if int(b) < 10:
b = "0"+str(b)
curtime = (a+":"+b+':'+c)
if curtime != newtime:
newtime = curtime
Clockupdate(newtime)
def playsound():
pygame.mixer.init()
pygame.mixer.music.load("ABTPP.mp3")
pygame.mixer.music.play()
global a
a = True
while a:
secondrefresher()