Answer the question
In order to leave comments, you need to log in
Is it possible to redirect output of exception messages to stderr?
Hello. As far as I understand, exception messages along with the stack trace are output to stdout. I would like to receive messages in stderr. Is it possible to implement this?
Answer the question
In order to leave comments, you need to log in
sys.stderr.write(err_msg) - just write something to
stderr
import traceback
try:
raise ValueError('Ошибка')
except Exception as e:
traceback.print_exc() # выводит в stderr
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question