Jessie runs on the Raspberry Pi 2. I have two displays, (by default) an HDMI display and an LCD touch screen (for which you need to set a couple of SDL-related variables using os.environ).
I have two pygame programs, lcd.py and hdmi.py, which, when launched from separate SSH terminals, coexist well, lcd.py dsiplays have several buttons, hdmi.py displays a slide show on the connected HDMI display.
If I run them separately in two SSH terminals (as the user “pi”, using sudo python PROGRAM), lcd.py is displayed on the LCD and hdmi.py displays the slideshow on the HDMI screen.
However, I cannot understand how lcd.py to call hdmi.py as a completely independent process (therefore, it has its own env variables and can control the HDMI display regardless of the parent process controlling the LCD).
The program lcd.pyhas a button that, when touched, calls the startSlideShow () procedure
However, various things that I tried to lcd.pystart in startSlideShow () hdmi.pydo not execute:
def startSlideShow():
WHAT GOES HERE?
Continuous interprocess communication is not required. In addition, when the lcd.py program is to “launch” the hdmi.py program, they do not need to communicate, and in fact it is not so important for me whether lcd completes the completion of the hdmi.py program.
Things I tried in startSlideShow () that do not work :
cmd = "sudo /usr/bin/python /home/pi/Desktop/code/hdmi.py"
pid = os.spawnl(os.P_NOWAIT, cmd)
AND
cmd = "sudo /usr/bin/python /home/pi/Desktop/code/hdmi.py"
pid = os.spawnl(os.P_DETACH, cmd)
and
cmd = "sudo /usr/bin/python /home/pi/Desktop/code/hdmi.py"
pid = os.spawnl(os.P_WAIT, cmd)
AND
cmd = ["/usr/bin/python", "/home/pi/Desktop/code/hdmi.py" ]
pid = subprocess.Popen(cmd, stdout=subprocess.PIPE).pid
AND
cmd = ["/usr/bin/python", "/home/pi/Desktop/code/hdmi.py" ]
pid = subprocess.Popen(cmd).pid
and
pid = os.spawnlp(os.P_NOWAIT, "/usr/bin/python", "/home/pi/Desktop/code/hdmi.py")
AND
pid = os.spawnlp(os.P_NOWAIT, "/usr/bin/python /home/pi/Desktop/code/hdmi.py")