0

I've got a probably simple (and probably even already answered) question regarding displaying output from several scripts and at the same time writing their stout/stderr to a log file:

I have a script "my_script.sh" which itself calls another script like that:

./my_to_be_logged_script.sh 2>&1 | tee -a "$LOGFILE"

my_to_be_logged_script.sh among other operations calls a Python script and another shell script like that:

./my_to_be_logged_shell_subscript.sh
python "my_to_be_logged_py_subscript.py" 

First of all, everything is logged properly to LOGFILE.

The shell script output is displayed in real-time but the console displays the output of the Python script only when the Python script has completed. Is there a way to display the Python output in real-time?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
hitme
  • 51
  • 2
  • possible duplicate of [Python output buffering](http://stackoverflow.com/questions/107705/python-output-buffering) – Celada Oct 17 '12 at 15:00

1 Answers1

0

try python -u "my_to_be_logged_py_subscript.py"

Wu Yongzheng
  • 1,707
  • 17
  • 23