Hide all warnings in ipython

I eventually figured it out. Place: import warnings warnings.filterwarnings(‘ignore’) inside ~/.ipython/profile_default/startup/disable-warnings.py. I’m leaving this question and answer for the record in case anyone else comes across the same issue. Quite often it is useful to see a warning once. This can be set by: warnings.filterwarnings(action=’once’)

Automatically import modules when entering the python or ipython interpreter

For ipython, there are two ways to achieve this. Both involve ipython’s configuration directory which is located in ~/.ipython. Create a custom ipython profile. Or you can add a startup file to ~/.ipython/profile_default/startup/ For simplicity, I’d use option 2. All you have to do is place a .py or .ipy file in the ~/.ipython/profile_default/startup directory … Read more

ipython reads wrong python version

Okay quick fix: which python gives you /usr/bin/python, right? Do which ipython and I bet that’ll be /usr/local/bin/ipython. Let’s look inside: Edit 9/7/16 — The file now looks like this: cat /usr/local/bin/ipython #!/usr/bin/python # -*- coding: utf-8 -*- import re import sys from IPython import start_ipython if __name__ == ‘__main__’: sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$’, ”, sys.argv[0]) … Read more

How to hide code from cells in ipython notebook visualized with nbviewer?

from IPython.display import HTML HTML(”'<script> code_show=true; function code_toggle() { if (code_show){ $(‘div.input’).hide(); } else { $(‘div.input’).show(); } code_show = !code_show } $( document ).ready(code_toggle); </script> <form action=”javascript:code_toggle()”><input type=”submit” value=”Click here to toggle on/off the raw code.”></form>”’)