Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4151

Beginners • Re: Auto Run Python script error xdg_runtime_dir not set in the environment

$
0
0
I use mplayer and autostart to play my mp3 songs in my eJukeBox Python3 script.
I did notice I have to wait a few seconds before running the code to allow everything to get set up.
Edit: After all the import statements I used "sleep(5)" for the delay.

Code:

         args = []         args.append("mplayer")         args.append("-quiet")         args.append(song_path + "/" + song_list[0] + ".mp3")         try:             output = subprocess.run(args,capture_output = True)         except KeyboardInterrupt:            done = True#            print("done")            sleep(1)            continue         except:#            print("Can't play " + song_list[0])

Statistics: Posted by SurferTim — Fri Nov 01, 2024 9:26 am



Viewing all articles
Browse latest Browse all 4151

Trending Articles