Subj : Re: Python help... To : paulie420 From : Dr. What Date : Thu Sep 03 2020 09:05:26 -=> paulie420 wrote to All <=- pa> # Setup Randon Videos pa> videoPath = "/home/pi/Videos/" pa> videoList = os.listdir(videoPath) pa> random.shuffle(videoList) pa> for video in videoList: pa> target = os.path.join(videoPath, video) Not part of your question, but I don't see the reason to get the video list all the time, then go through the video list to get the last one to play. I suggest putting this code outside the While loop. Then when the button is pressed, just pick a random number and play the video at that location in the list of videos. pa> # Wait for button press pa> print("Waiting for button press to start video.") pa> button.wait_for_active() pa> os.system('omxplayer --aspect-mode stretch "{}" > pa> /dev/null'.format(target)) pa> #subprocess.Popen('omxplayer --acpect-mode stretch "{}" > pa> /dev/null'.format(target)) os.system runs a command, then waits for it to complete before continuing. So, if you want the button to be deactivated while the video is playing, then os.system is the way to go. subprocess.Popen is used to execute a process, but makes it easier for you to communicate with the subprocess. But it also allows you to run the process in the "background" (i.e. once you run it, it returns immediately - but now you have to manage the process, poll it periodically, etc.) IHMO, unless you are already very familiar with Linux and subproceses, I suggest that you do not use this. pa> but #didnt work YET. The os.system does play a video... just waits pa> there before #listening again for a button press. Then the issue is with omxplayer. It's not exiting when it's done playing the video. .... You have two choices for dinner: Take it or Leave it. ___ MultiMail/Linux v0.52 --- Mystic BBS/QWK v1.12 A45 2020/02/18 (Linux/32) * Origin: 1984 BBS (1337:3/128) .