Skip to content

Instantly share code, notes, and snippets.

@loisaidasam
Created February 17, 2014 21:30
Show Gist options
  • Save loisaidasam/9059582 to your computer and use it in GitHub Desktop.
Save loisaidasam/9059582 to your computer and use it in GitHub Desktop.
A script to fix that annoying ipython DeprecationWarning
#!/bin/bash
# A script to fix that annoying ipython deprecation warning for
# "DeprecationWarning: With-statements now directly support multiple context managers"
# via https://github.com/matematikaadit/matematikaadit.github.io/issues/29
FILENAME=`ipython locate`/profile_default/startup/00-disable-deprecation-warning.py
if [ ! -f $FILENAME ]
then
FILE=$( cat <<EOF
# hide deprecation warning
# IPython/terminal/interactiveshell.py:432:
# DeprecationWarning: With-statements now directly ...
import warnings
import exceptions
warnings.filterwarnings("ignore",
category=exceptions.DeprecationWarning,
module='IPython.terminal.interactiveshell',
lineno=432) # change lineno to your line number warning
EOF
)
echo "$FILE" > $FILENAME
echo "Created $FILENAME"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment