Created
May 6, 2015 09:12
-
-
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
This file contains hidden or 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
# 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