Subj : Python help... To : All From : paulie420 Date : Tue Sep 01 2020 04:43 pm I am working on a Raspberry Pi Zero project. Using a 1941 Phil co Predictatelevision, that I fully refurbished, I want to c reate some python code toplay a random video with a digital touch sensor module.The digital touch sensory module is a bit different from a push button,because you can set it  by some wood or small metal area and push a 'button'that do esn't appear to be there. Thats important, because I don't want to modify this antique in any way...Ok, so anyway... I have pyth on randomizing the files... I have it usingomxplayer to play  a video... but then python/the linux box just sits therewit h the video player - not waiting for the next button press until the videois completely over. I thought I could u se subprocess.Popen instead of os.system, but I haven'tfigur ed out if that it true - nor the correct syntax to doso. Anyone wanna look at my code and see if they can help? Again, the s etup is Raspberry Pi Zero holds videos... I want the pythons cript to wait for a button (digtal input device) press, play a random  videoand then play another random video if I press the butt on again. (I know, too,that I'll have to put some kill proce ss code in there... but I figured I'dget to that after I fig ured out how to wait for next button press prior tovideo end ing...) Heres my current code:-----fro m gpiozero import DigitalInputDevicefrom time import sleep import osimport randomimport subprocessbutton = DigitalInputDevice(21)while True:# Setup Ran don VideosvideoPath = "/home/pi/Videos/"vide oList = os.listdir(videoPath)random.shuffle(videoList) for video in videoList:target = os.path.join(videoPath, vide o)# Wait for button pressprint("Waiting for butt on press to start video.")button.wait_for_active() os.system('omxplayer --aspect-mode stretch "{}" >/dev/null'.form at(target))#subprocess.Popen('omxplayer --acpect-mode  stretch "{}" >/dev/null'.format(target))#The  subprocess was my idea that would let python continue listening... b ut #didnt work YET. The os.system does play a video... just  waits there before#listening again for a button press. -----pAULIE42o... ...... .