Disable IPython Exit Confirmation

PythonIpython

Python Problem Overview


It's really irritating that every time I type exit(), I get prompted with a confirmation to exit; of course I want to exit! Otherwise, I would not have written exit()!!!

Is there a way to override IPython's default behaviour to make it exit without a prompt?

Python Solutions


Solution 1 - Python

If you also want Ctrl-D to exit without confirmation, in IPython 0.11, add c.TerminalInteractiveShell.confirm_exit = False to your config file *.

If you don't have a config file yet, run ipython profile create to create one.

Note this ticket if you're working within the Django shell.


* The config file is located at: $HOME/.ipython/profile_default/ipython_config.py

Solution 2 - Python

In ipython version 0.11 or higher,

  1. Run with --no-confirm-exit OR

  2. Exit via 'exit' instead of control-D OR

  3. Make sure the directory exists (or run ipython profile create to create it) and add these lines to $HOME/.ipython/profile_default/ipython_config.py:

     c = get_config()
    
     c.TerminalInteractiveShell.confirm_exit = False
    

Solution 3 - Python

just type Exit, with capital E.

Alternatively, start IPython with:

$ ipython -noconfirm_exit

Or for newer versions of IPython:

$ ipython --no-confirm-exit 

Solution 4 - Python

I like the config suggestions, but until I learned them I've started using "Quit" key combination.

Ctrl+\

or

Ctrl+4

This just kills what is running. No time to ask questions on confirmation.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNaftuli KayView Question on Stackoverflow
Solution 1 - PythontuomassaloView Answer on Stackoverflow
Solution 2 - PythonErnestView Answer on Stackoverflow
Solution 3 - Pythonnye17View Answer on Stackoverflow
Solution 4 - PythonMikhailView Answer on Stackoverflow