Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPython crashes on %recall of a non existing history line #10296

rajathagasthya opened this issue Feb 16, 2017 · 5 comments

IPython crashes on %recall of a non existing history line #10296

rajathagasthya opened this issue Feb 16, 2017 · 5 comments


Copy link

rajathagasthya commented Feb 16, 2017

I tried to do a %recall of a history line which was non existent and IPython crashed completely throwing an exception. I would expect this to just say the history wasn't found, but not outright crash.

This is exception that I got:

Python 3.6.0 (default, Dec 24 2016, 08:01:42)
Type "copyright", "credits" or "license" for more information.

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

In [1]: %recall 19
Couldn't evaluate or find in history: 19

In [2]: %recall 19
Traceback (most recent call last):
  File "/usr/local/bin/ipython3", line 11, in <module>
  File "/usr/local/lib/python3.6/site-packages/IPython/", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/", line 658, in launch_instance
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/", line 348, in start
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/", line 455, in mainloop
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/", line 438, in interact
    code = self.prompt_for_code()
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/", line 343, in prompt_for_code
    pre_run=self.pre_prompt, reset_current_buffer=True)
  File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/", line 408, in run
  File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/", line 383, in _pre_run
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/", line 425, in pre_prompt
    self.pt_cli.application.buffer.text = cast_unicode_py2(self.rl_next_input)
  File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/", line 371, in text
    assert self.cursor_position <= len(value)

If you suspect this is an IPython bug, please report it at:
or send an email to the mailing list at

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    %config Application.verbose_crash=True

I also enabled %config Application.verbose_crash=True and tried it again to get a verbose crash report. I've attached it here: Crash_report_ipython.txt

Let me know if I'm doing anything incorrect or if I can help fix this problem. Thanks!

Copy link

takluyver commented Feb 16, 2017

Thanks. There's a fix pending in #10231 ; in the meantime, you can work around the issue by downgrading prompt_toolkit to < 1.0.10.

Copy link

hezhiming commented Feb 17, 2017

I have the same problem #10299

The prompt_toolkit cause the problem :P

Copy link

hezhiming commented Feb 19, 2017

You can solve this problem by

  1. pip uninstall prompt_toolkit
  2. pip install prompt_toolkit == 1.0.9

I remember @takluyver says they will fix this bug in ipython5.3 : P

Copy link

akras-apixio commented Feb 20, 2017

Had to do, pip install 'prompt_toolkit == 1.0.9'

But the crash is gone, thank you

@Carreau Carreau modified the milestone: no action May 30, 2017
Copy link

agn-7 commented Apr 22, 2022

I had the same problem and solve that with the following command:

pip install -U prompt_toolkit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

6 participants