rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
370 stars 144 forks source link

How can I open a luma script from another python script using subprocess #79

Closed craver2000 closed 6 years ago

craver2000 commented 6 years ago

I would like to ask about how I can launch a luma oled script from a parent script. I have used:

import subprocess # to use subprocess 

p = subprocess.Popen(['python', 'demo_oled_v01.py --display ssd1351 --width 128 --height 128 --interface spi --gpio-data-command 20'])

in my parent script but I got an error stating:

python: can't open file 'demo_oled_v01.py --display ssd1351 --width 128 --height 128 --interface spi --gpio-data-command 20': [Errno 2] No such file or directory

I suspect that adding the parameters --display ssd1351 --width 128 --height 128 --interface spi --gpio-data-command 20 after .py may be causing difficulty in launching the oled script. These parameters are otherwise essential for me to include for launching with bash commands on terminal. How can I use subprocess with the required luma library parameters to launch a SSD1351 based script?