title: Python subprocess display logs on terminal and save in file
body: <p>I am running a Python script using subprocess and willing to save output to a file as well as show live logs on terminal.<br>
  I have written below code and its saving logs in file but not showing live script execution logs on terminal.    </p>
  
  <pre><code>TCID = sys.argv[1]
  
      if TCID == "5_2_5_3":
          output = subprocess.check_output([sys.executable, './script.py'])
          with open('scriptout.log', 'wb') as outfile:
              outfile.write(output)
  </code></pre>