prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Unhandled exception in event loop: in ipython

Open
#869 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

Exception
Press ENTER to continue...

Unhandled exception in event loop:
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/posix.py", line 154, in _run_task
t()
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/context.py", line 115, in new_func
return func(*a, **kw)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 404, in flush_keys
self.process_keys()
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 273, in process_keys
self._process_coroutine.send(key_press)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 180, in _process
self._call_handler(matches[-1], key_sequence=buffer[:])
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 323, in _call_handler
handler.call(event)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 78, in call
return self.handler(event)
File "/usr/local/lib/python3.6/site-packages/IPython/terminal/shortcuts.py", line 157, in reset_buffer
b.cancel_completion()
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/buffer.py", line 788, in cancel_completion
self.go_to_completion(None)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/buffer.py", line 853, in go_to_completion
new_text, new_cursor_position = state.new_text_and_position()
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/buffer.py", line 93, in new_text_and_position
c = self.completions[self.complete_index]

Exception list index out of range
Press ENTER to continue...

Unhandled exception in event loop:
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/application/run_in_terminal.py", line 95, in _run_in_t
result = yield From(async_func())
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 701, in print_exception
yield From(_do_wait_for_enter('Press ENTER to continue...'))
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 971, in _do_wait_for_enter
yield From(session.app.run_async())
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next
new_f = coroutine.throw(exc)
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 658, in _run_async2
result = yield f
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/eventloop/coroutine.py", line 92, in step_next
new_f = coroutine.send(f.result())
File "/usr/local/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 610, in _run_async
result = yield From(f)

Exception
Press ENTER to continue...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the IPython interaction that produces the traceback, then read prompt_toolkit/buffer.py around go_to_completion and prompt_toolkit/key_binding/key_processor.py around process_keys. Trace how IPython/terminal/shortcuts.py reset_buffer reaches the completion state, and consider the issue done when the same interaction no longer raises the unhandled exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.