So i’m running a simple script that plays a sound every hour and for some reason it works normaly when it is activated just before it needs to play the sound, but when i leave it running it doesn’t play it
import datetime
import pygame
import time
pygame.init()
pygame.mixer.init()
file = r”C:UsersadamdPython v3budzikdzwon.mp3″
sound = pygame.mixer.Sound(file)
def start():
while True:
if datetime.datetime.now().second == 0:
clock()
return
time.sleep(0.5)
def clock():
while True:
while datetime.datetime.now().minute != 0:
time.sleep(30)
a = datetime.datetime.now()
b = 0
for x in range(int(a.strftime("%I"))):
sound.play()
b = b + 3
time.sleep(3)
time.sleep(60 - b)
start()
i’m expecting it to play the sound but after like 15 min it just doesn’t play it
0