To display both stdout and stderr on the terminal while only capturing stderr to file, use:
python3 ./script.py --input ./*.txt --verbose 2>&1 1>/dev/tty | tee -a script.log
The way that the shell handles redirections is quite subtle. Here, the 2>&1
results in the command's stderr being piped to the tee
command. 1>/dev/tty
results in the command's stdout going directly to terminal. Order is important. If the order of these redirections is reversed, nothing would go to the pipe. Alternatively, if 1>/dev/tty
were omitted, then both stdout and stderr would be piped to the tee
command.