1

I have a Python script running on a Linux machine which is printing output out to the terminal. Currently, I'm logging this output to a file using the script command. However, the problem with this approach is that I am not able to read the data added to the file while the script is running; I want to periodically scp this file onto my local machine to read.

Is there any way I can redirect the output of my script such that file is being appended to and closed after every line is printed?

Thanks.

1 Answer 1

0

After some searching, I found the solution to my problem:

stdbuf -oL python script.py >> log.txt

This does exactly what I wanted.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .