prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.11k stars 717 forks source link

Unhandled exception in event loop: in ipython #869

Open QGB opened 5 years ago

QGB commented 5 years ago

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...

noragen commented 5 years ago

I got that, too. This looks like a race condition caused by the key_processor! The eventhandling should probably be improved.

meereeum commented 4 years ago

upvoting this as a problem!