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?
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?
Not recommended, but
except Exception:
pass
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.