Jack477 / CommanderPi

Easy RaspberryPi4 GUI system managment
MIT License
188 stars 33 forks source link

logging runs in buffered mode on python3.7 #60

Open wjgeorge opened 3 years ago

wjgeorge commented 3 years ago

apparently a small chnage in python3.7, stderr is buffered so output to logfile will only happen when the buffer is full. These two command will perform differntly

sudo python3 ${HOME}/CommanderPi/src/main.py ${HOME}

vs

sudo python3 ${HOME}/CommanderPi/src/main.py ${HOME} > logfile.txt

See:

https://stackoverflow.com/questions/22471023/python-sys-stderr-flush-frequency