Launch a python script from another script, with parameters in subprocess argument

The subprocess library is interpreting all of your arguments, including demo_oled_v01.py as a single argument to python. That’s why python is complaining that it cannot locate a file with that name. Try running it as:

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

See more information on Popen here.

Leave a Comment