Skip to content

Instantly share code, notes, and snippets.

@jorenham
Last active September 28, 2019 22:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jorenham/193cf7fb3474887651b10c4f88ea0417 to your computer and use it in GitHub Desktop.
Save jorenham/193cf7fb3474887651b10c4f88ea0417 to your computer and use it in GitHub Desktop.
Best exception handling in Python
import webbrowser
def main():
return 42/0
if __name__== '__main__':
try:
main()
except Exception as e:
webbrowser.open_new_tab('https://stackoverflow.com/search?q=[python] {}'.format(e))
raise e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment