I am a Debian and RedHat user. I would like to redirect stderr (module logging
) from a Python3
script. The script outputs a lot of things and the part I want to capture can be fetched using:
python3 ./script.py --input ./*.txt --verbose 2>> ./script.log
This appends stderr to ./script.log
. But I would keep this dialog also in terminal. Usually I achieve this by piping the tee
command. The problem is, the following shell
line (executed from a bash
file):
pyhton3 ./script.py --input ./*.txt --verbose | tee -a ./script.log
Does output into the terminal but does not output anything to ./script.log
.
Any idea how to proceed?