I have a Sense Hat and want to run this oython script at boot:
from sense_hat import SenseHat from pydub import AudioSegment from pydub.playback import play
song = AudioSegment.from_wav("/home/pi/redalert.wav")
sense = SenseHat()
x = 0.1 y = 204,0,0 z = 0,0,153 y1 = 25,0,0 z1 = 255,255,0
while True: play(song) play(song) sense.show_message("!!! Intuder Alert ", x, y, z)
Now if I boot the Pi and then run the script it runs fine and the sound plays.
However if I use
@reboot python3 /home/pi/intruder.py via a cron job, the message is displayed but no sound.