I am using smtpd and its catching ValueError exceptions I raise in process_message and printing a description to stderr instead of raising the error. What it prints out is the string I construct the ValueError with.
So if I do this in process_message:
raise ValueError("550, This is the error")
I see
550, This is the error
on the console. I cannot for the life of me find what code is causing the print. Is there anyway to override stderr to show a stacktrace each time something is printed or otherwise locate what lines of code are printing out these lines?
You can replace one the standard output streams with something that traces invocations of
write()
:Note that I'm using
__stderr__
to avoid loops.