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

Closed
rajathagasthya opened this Issue Feb 16, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@rajathagasthya

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

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Feb 16, 2017

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.

Member

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.

@hezhiming

This comment has been minimized.

Show comment
Hide comment
@hezhiming

hezhiming Feb 17, 2017

I have the same problem #10299

The prompt_toolkit cause the problem :P

I have the same problem #10299

The prompt_toolkit cause the problem :P

@hezhiming

This comment has been minimized.

Show comment
Hide comment
@hezhiming

hezhiming 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

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

This comment has been minimized.

Show comment
Hide comment
@akras-apixio

akras-apixio Feb 20, 2017

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

But the crash is gone, thank you

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

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