In Python, is there any language (or interpreter) function to force the python interpreter to always throw exceptions, even if the code causing the violation is inside the try / except block?
I just inherited a large and old code base written in python, the purpose of which is to communicate with some specially designed hardware that we also developed. Many error messages and timeouts are masked / skipped due to the following (simplified) code template:
try:
serialport.write(MSG)
except:
some_logging_function_mostly_not_working_that_might_be_here_or_not()
To avoid the typical “just rewrite everything from scratch” scenario, I'm currently trying to fix all the errors / exception timeouts. I do this by manually disabling all exception handling code, one at a time.
user97735
source
share