Python subprocess tee to screen and variable

Python subprocess can be used to run a long-running program, capturing the output to a variable and printing to the screen simultaneously. This gives the user the comfort that the program is working OK and gives program status messages without waiting for the program to finish.

This example demonstrates the “tee” subprocess behavior.