I have python code that catches an exception:
# ...
except Exception:
# Handle the exception
When this code is executed, the traceback (stack trace) is printed to the console. How can I suppress it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not recommended, but
Will silently ignore the exception. However, if you don’t fix what went wrong, your program may quit anyways because something further down in your code will throw another exception. You should at the least print out a message stating what happened, or debugging your code can be a nightmare.