Skip to content

Instantly share code, notes, and snippets.

@hexsprite
Created July 3, 2014 17:24
Show Gist options
  • Save hexsprite/06d5c5cd13cbcae4ba24 to your computer and use it in GitHub Desktop.
Save hexsprite/06d5c5cd13cbcae4ba24 to your computer and use it in GitHub Desktop.
Python: ignore specific warning using context manager
import warnings
def fxn():
warnings.warn("deprecated", DeprecationWarning)
with warnings.catch_warnings():
warnings.filterwarnings('ignore', category=DeprecationWarning)
fxn()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment