Skip to content

Instantly share code, notes, and snippets.

@leifdenby
Created May 6, 2015 09:12
Show Gist options
  • Save leifdenby/4fc9e5cac187b88b21c7 to your computer and use it in GitHub Desktop.
Save leifdenby/4fc9e5cac187b88b21c7 to your computer and use it in GitHub Desktop.
Python warnings: Disable printing the content of the line that caused a warning
# disable printing lines for warnings
old_warning_formatter = warnings.formatwarning
warnings.formatwarning = lambda message, category, filename, lineno, line=None: old_warning_formatter(message, category, filename, lineno, False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment