How to suppress IPython startup message?

When debugging, I often go into the IPython shell for interactive code testing. However, this also leads to a large python version informational dump, date and help instructions for stdout. How can I suppress this information so that it does not hide intentional debug messages?

x = get_important_data()
print 'important info! right here! The data is in variable "x"'
import IPython
IPython.embed()

This code gives the output as follows:

important info! right here! The data is in variable "x"
Python 2.7.11 |Anaconda 2.4.0 (x86_64)| (default, Dec  6 2015, 18:57:58) 
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython features.
%quickref -> Quick reference.
help      -> Python own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:
+4
source share
1 answer

You can do it:

IPython.embed(banner1="")

Installing banner1on an empty line will delete startup messages. It will not actually delete messages, but will replace them with blank lines.

You can also add useful messages using the options banner1, banner2and exit_msg:

IPython.embed(
    banner1="Entering Debug Mode", 
    banner2="Here another helpful message",
    exit_msg="Exiting the debug mode!"
)

- IPython , :

ipython --no-banner
+3

Source: https://habr.com/ru/post/1624340/


All Articles