Jan-06-2018, 07:56 AM
There may be more robust ways to detect if the process uses a terminal. With the psutil module one can write
import psutil proc = psutil.Process() if proc.terminal() is None: print("This process doesn't use a terminal")