Created
February 2, 2015 20:00
-
-
Save matthewdeanmartin/173c380cb7522ca0d6b8 to your computer and use it in GitHub Desktop.
Add this and I find out the app is constantly throwing errors that were previously hidden.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import traceback | |
# https://stackoverflow.com/questions/6666882/tkinter-python-catching-exceptions | |
# https://stackoverflow.com/questions/739654/how-can-i-make-a-chain-of-function-decorators-in-python | |
# https://stackoverflow.com/questions/1415812/why-use-kwargs-in-python-what-are-some-real-world-advantages-over-using-named | |
def handle_tk_errors(method_to_decorate): | |
def wrapper(*args, **kwargs): | |
try: | |
return method_to_decorate(*args, **kwargs) | |
except Exception as ex: | |
traceback.print_exc() | |
print("Error: %s" % ex) | |
sys.exit(1) | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment