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

Closed
rajathagasthya opened this issue Feb 16, 2017 · 5 comments
Closed

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

rajathagasthya opened this issue Feb 16, 2017 · 5 comments
Milestone

Comments

@rajathagasthya
Copy link

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>
    sys.exit(start_ipython())
  File "/usr/local/lib/python3.6/site-packages/IPython/__init__.py", line 119, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/ipapp.py", line 348, in start
    self.shell.mainloop()
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 455, in mainloop
    self.interact()
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 438, in interact
    code = self.prompt_for_code()
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", 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/interface.py", line 408, in run
    self._pre_run(pre_run)
  File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/interface.py", line 383, in _pre_run
    pre_run()
  File "/usr/local/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", 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/buffer.py", line 371, in text
    assert self.cursor_position <= len(value)
AssertionError

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@scipy.org

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!

@takluyver
Copy link
Member

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.

@ming2281
Copy link

I have the same problem #10299

The prompt_toolkit cause the problem :P

@ming2281
Copy link

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

@akras-apixio
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
@agn-7
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants